--[[
LuCI - Lua Configuration Interface
]]--
local taskd = require "luci.model.tasks"
local discourse_model = require "luci.model.discourse"
local m, s, o
m = taskd.docker_map("discourse", "discourse", "/usr/libexec/apps/discourse/discourse.sh",
translate("discourse"),
translate("Discourse is an open source discussion platform with built-in moderation and governance systems that let discussion communities protect themselves from bad actors even without official moderators.")
.. translate("Official website:") .. ' https://hub.docker.com/r/bitnami/discourse/')
s = m:section(SimpleSection, translate("Service Status"), translate("discourse status:"))
s:append(Template("discourse/status"))
s = m:section(TypedSection, "discourse", 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 = "8787"
o.datatype = "port"
o = s:option(Value, "image_name", translate("Image").."*")
o.rmempty = false
o.datatype = "string"
o:value("docker.io/bitnami/discourse", "docker.io/bitnami/discourse")
o.default = "docker.io/bitnami/discourse"
local blocks = discourse_model.blocks()
local home = discourse_model.home()
o = s:option(Value, "config_path", translate("Enter router IP or domain name").."*")
o.rmempty = false
o.datatype = "string"
o:value("192.168.70.1", "192.168.70.1")
o.default = "192.168.70.1"
local paths, default_path = discourse_model.find_paths(blocks, home, "Configs")
for _, val in pairs(paths) do
o:value(val, val)
end
o.default = default_path
return m