--[[
LuCI - Lua Configuration Interface
]]--
local taskd = require "luci.model.tasks"
local nodered_model = require "luci.model.nodered"
local m, s, o
m = taskd.docker_map("nodered", "nodered", "/usr/libexec/apps/nodered/nodered.sh",
translate("Nodered"),
translate("Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.")
.. translate("Official website:") .. ' https://www.nodered.org/')
s = m:section(SimpleSection, translate("Service Status"), translate("nodered status:"))
s:append(Template("nodered/status"))
s = m:section(TypedSection, "nodered", translate("Setup"), translate("Refresh to update settings."))
s.addremove=false
s.anonymous=true
o = s:option(Value, "port", translate("Port").."*")
o.rmempty = false
o.default = "1880"
o.datatype = "port"
o = s:option(Value, "image_name", translate("Image").."*")
o.rmempty = false
o.datatype = "string"
o:value("nodered/node-red:latest", "nodered/node-red:latest")
o.default = "nodered/node-red:latest"
local blocks = nodered_model.blocks()
local home = nodered_model.home()
o = s:option(Value, "config_path", translate("Config path").."*")
o.rmempty = false
o.datatype = "string"
o:value("/opt/docker2/compose/nodered-app", "/opt/docker2/compose/nodered-app")
o.default = "/opt/docker2/compose/nodered-app"
local paths, default_path = nodered_model.find_paths(blocks, home, "Configs")
for _, val in pairs(paths) do
o:value(val, val)
end
o.default = default_path
return m