Mercurial Hosting > luan
diff core/src/luan/modules/host/Hosting.luan @ 743:2c41f2aec92f
improve Rpc and implement rpc call for local webserver
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 13 Jul 2016 17:27:35 -0600 |
parents | 5578541125ea |
children |
line wrap: on
line diff
--- a/core/src/luan/modules/host/Hosting.luan Tue Jul 12 17:47:30 2016 -0600 +++ b/core/src/luan/modules/host/Hosting.luan Wed Jul 13 17:27:35 2016 -0600 @@ -14,14 +14,12 @@ local M = {} -M.port = 9101 function M.push(domain,password,dir) local my_dir = Io.uri("file:"..dir) my_dir.exists() or error("directory '"..dir.."' not found") my_dir.is_directory() or error("'"..dir.."' is not a directory") - local socket = "socket:" .. domain .. ":" .. M.port - local host = Rpc.remote(socket) + local host = Rpc.remote(domain) local tree = host.get(domain,password) if tree == nil then print("creating "..domain) @@ -64,32 +62,27 @@ end function M.delete(domain,password) - local socket = "socket:" .. domain .. ":" .. M.port - local host = Rpc.remote(socket) + local host = Rpc.remote(domain) host.delete(domain,password) end function M.exists(domain) - local socket = "socket:" .. domain .. ":" .. M.port - local host = Rpc.remote(socket) + local host = Rpc.remote(domain) return host.exists(domain) end function M.change_domain(old_domain,new_domain,password) - local socket = "socket:" .. new_domain .. ":" .. M.port - local host = Rpc.remote(socket) + local host = Rpc.remote(new_domain) return host.change_domain(old_domain,new_domain,password) end function M.change_password(domain,old_password,new_password) - local socket = "socket:" .. domain .. ":" .. M.port - local host = Rpc.remote(socket) + local host = Rpc.remote(domain) return host.change_password(domain,old_password,new_password) end function M.caller(domain) - local socket = "socket:" .. domain .. ":" .. M.port - local host = Rpc.remote(socket) + local host = Rpc.remote(domain) local mt = {} function mt.__index(_,key) return function(...)