diff --git a/modules/setting/discussion_server.go b/modules/setting/discussion_server.go new file mode 100644 index 000000000..f149006cb --- /dev/null +++ b/modules/setting/discussion_server.go @@ -0,0 +1,20 @@ +package setting + +import "fmt" + +var DiscussionServer = struct { + Host string + Port int + Url string +}{ + Host: "localhost", + Port: 8081, + Url: "http://localhost:8081", +} + +func loadDiscussionServerFrom(rootCfg ConfigProvider) { + sec := rootCfg.Section("discussion_server") + DiscussionServer.Host = sec.Key("HOST").MustString("localhost") + DiscussionServer.Port = sec.Key("PORT").MustInt(8081) + DiscussionServer.Url = fmt.Sprintf("http://%s:%d", DiscussionServer.Host, DiscussionServer.Port) +} diff --git a/modules/setting/setting.go b/modules/setting/setting.go index f056fbfc6..c08736898 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -118,6 +118,7 @@ func loadCommonSettingsFrom(cfg ConfigProvider) error { loadLogGlobalFrom(cfg) loadServerFrom(cfg) loadSSHFrom(cfg) + loadDiscussionServerFrom(cfg) mustCurrentRunUserMatch(cfg) // it depends on the SSH config, only non-builtin SSH server requires this check diff --git a/routers/install/install.go b/routers/install/install.go index fde8b37ed..497a6e09e 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -399,6 +399,10 @@ func SubmitInstall(ctx *context.Context) { cfg.Section("server").Key("ROOT_URL").SetValue(form.AppURL) cfg.Section("server").Key("APP_DATA_PATH").SetValue(setting.AppDataPath) + // TODO: hardcoded for now, make it configurable later + cfg.Section("discussion_server").Key("HOST").SetValue("localhost") + cfg.Section("discussion_server").Key("PORT").SetValue("8081") + if form.SSHPort == 0 { cfg.Section("server").Key("DISABLE_SSH").SetValue("true") } else {