You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.6 KiB
Lua

--[[
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:") .. ' <a href=\"https://www.nodered.org/\" target=\"_blank\">https://www.nodered.org/</a>')
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").."<b>*</b>")
o.rmempty = false
o.default = "1880"
o.datatype = "port"
o = s:option(Value, "image_name", translate("Image").."<b>*</b>")
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").."<b>*</b>")
o.rmempty = false
o.datatype = "string"
o:value("/opt/docker2/compose/Config/nodered", "/opt/docker2/compose/Config/nodered")
o.default = "/opt/docker2/compose/Config/nodered"
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