feat. add discussion_server setting configuration
This commit is contained in:
parent
f9c73568c5
commit
0390e49210
20
modules/setting/discussion_server.go
Normal file
20
modules/setting/discussion_server.go
Normal file
|
@ -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)
|
||||
}
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user