Skip to content

Commit

Permalink
fix issue #83
Browse files Browse the repository at this point in the history
  • Loading branch information
lisaac committed Jun 6, 2021
1 parent 739fa94 commit e580495
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
cat >/tmp/luci-app-dockerman/CONTROL/control <<EOF
Package: luci-app-dockerman
Version: ${TAG}
Depends: luci-lib-docker, ttyd, docker, dockerd
Depends: luci-lib-docker, ttyd, docker, dockerd, luci-lib-ip
Architecture: all
Maintainer: lisaac<https://github.com/lisaac/luci-app-dockerman>
Section: base
Expand Down
1 change: 1 addition & 0 deletions applications/luci-app-dockerman/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ LUCI_TITLE:=LuCI Support for docker
LUCI_DEPENDS:=@(aarch64||arm||x86_64) \
+luci-compat \
+luci-lib-docker \
+luci-lib-ip \
+docker \
+dockerd \
+ttyd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function get_containers()
local ip = require "luci.ip"
for _,v2 in ipairs(v.Ports) do
-- display ipv4 only
if ip.new(v2.IP):is4() then
if ip.new(v2.IP or "0.0.0.0"):is4() then
data[index]["_ports"] = (data[index]["_ports"] and (data[index]["_ports"] .. ", ") or "")
.. ((v2.PublicPort and v2.Type and v2.Type == "tcp") and ('<a href="javascript:void(0);" onclick="window.open((window.location.origin.match(/^(.+):\\d+$/) && window.location.origin.match(/^(.+):\\d+$/)[1] || window.location.origin) + \':\' + '.. v2.PublicPort ..', \'_blank\');">') or "")
.. (v2.PublicPort and (v2.PublicPort .. ":") or "") .. (v2.PrivatePort and (v2.PrivatePort .."/") or "") .. (v2.Type and v2.Type or "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ remote_port.default = "2375"
-- debug.disabled="false"
-- local debug_path = section_dockerman:taboption("dockerman", Value, "debug_path", translate("Debug Tempfile Path"), translate("Where you want to save the debug tempfile"))

if nixio.fs.access("/usr/bin/dockerd") then
-- if nixio.fs.access("/usr/bin/dockerd") then
local allowed_interface = section_dockerman:taboption("ac", DynamicList, "ac_allowed_interface", translate("Allowed access interfaces"), translate("Which interface(s) can access containers under the bridge network, fill-in Interface Name"))
local interfaces = luci.sys and luci.sys.net and luci.sys.net.devices() or {}
for i, v in ipairs(interfaces) do
Expand Down Expand Up @@ -150,13 +150,24 @@ if nixio.fs.access("/usr/bin/dockerd") then
hosts:value("unix:///var/run/docker.sock", "unix:///var/run/docker.sock")
hosts:value("tcp://0.0.0.0:2375", "tcp://0.0.0.0:2375")
hosts.rmempty = true
end
-- end

m.on_before_save = function(self)
m.uci:set("dockerd", "globals", "hosts", m.uci:get("dockerd", "dockerman", "daemon_hosts"))
m.uci:set("dockerd", "globals", "data_root", m.uci:get("dockerd", "dockerman", "daemon_data_root"))
m.uci:set("dockerd", "globals", "log_level", m.uci:get("dockerd", "dockerman", "daemon_log_level"))
m.uci:set("dockerd", "globals", "registry_mirrors", m.uci:get("dockerd", "dockerman", "daemon_registry_mirrors"))
local conf = m.uci:get("dockerd", "dockerman", "daemon_hosts")
if conf then
m.uci:set("dockerd", "globals", "hosts", conf)
else
m.uci:delete("dockerd", "globals", "hosts")
end
conf = m.uci:get("dockerd", "dockerman", "daemon_registry_mirrors")
if conf then
m.uci:set("dockerd", "globals", "registry_mirrors", conf)
else
m.uci:delete("dockerd", "globals", "registry_mirrors")
end
m.uci:set("dockerd", "globals", "data_root", m.uci:get("dockerd", "dockerman", "daemon_data_root") or "/opt/docker")
m.uci:set("dockerd", "globals", "log_level", m.uci:get("dockerd", "dockerman", "daemon_log_level") or "warn")
-- m.uci:commit("dockerd")
end

m.on_after_apply = function(self)
Expand Down

0 comments on commit e580495

Please sign in to comment.