summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-dockerman/luasrc/model/docker.lua
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2020-07-28 15:58:49 +0200
committerFlorian Eckert <fe@dev.tdt.de>2020-07-28 16:03:11 +0200
commitdff11ad2404d77be1da786883fa7155b83a67be0 (patch)
tree91d9e199c4fc06a180b51ac148c048c824dc40bd /applications/luci-app-dockerman/luasrc/model/docker.lua
parent18c2fef8b38df9d932200da0af7b61120984850a (diff)
luci-app-dockerman: refactoring remote endpoint options
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'applications/luci-app-dockerman/luasrc/model/docker.lua')
-rw-r--r--applications/luci-app-dockerman/luasrc/model/docker.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/applications/luci-app-dockerman/luasrc/model/docker.lua b/applications/luci-app-dockerman/luasrc/model/docker.lua
index 51b728742e..88b5cc4607 100644
--- a/applications/luci-app-dockerman/luasrc/model/docker.lua
+++ b/applications/luci-app-dockerman/luasrc/model/docker.lua
@@ -270,13 +270,23 @@ local duplicate_config = function (self, request)
end
_docker.new = function()
+ local host = nil
+ local port = nil
+ local socket = nil
- local remote = uci:get("dockerd", "globals", "remote_endpoint")
+ local remote = uci:get_bool("dockerd", "globals", "remote_endpoint")
+
+ if remote then
+ host = uci:get("dockerd", "globals", "remote_host") or nil
+ port = uci:get("dockerd", "globals", "remote_port") or nil
+ else
+ socket = uci:get("dockerd", "globals", "socket_path") or "/var/run/docker.sock"
+ end
_docker.options = {
- host = (remote == "true") and (uci:get("dockerd", "globals", "remote_host")) or nil,
- port = (remote == "true") and (uci:get("dockerd", "globals", "remote_port")) or nil,
- socket_path = (remote ~= "true") and (uci:get("dockerd", "globals", "socket_path") or "/var/run/docker.sock") or nil,
+ host = host,
+ port = port,
+ socket_path = socket,
debug = uci:get("dockerd", "globals", "debug") == 'true' and true or false,
debug_path = uci:get("dockerd", "globals", "debug_path") or "/tmp/.docker_debug",
status_path = uci:get("dockerd", "globals", "status_path") or "/tmp/.docker_status"