feature: Customizable external rest address
This commit is contained in:
parent
63068dfdea
commit
a725b377cc
|
|
@ -87,6 +87,7 @@ func DefaultConfig() *Config {
|
||||||
config.ListenAddressRestActions = "localhost:1338"
|
config.ListenAddressRestActions = "localhost:1338"
|
||||||
config.ListenAddressGrpcActions = "localhost:1339"
|
config.ListenAddressGrpcActions = "localhost:1339"
|
||||||
config.ListenAddressWebUI = "localhost:1340"
|
config.ListenAddressWebUI = "localhost:1340"
|
||||||
|
config.ExternalRestAddress = ""
|
||||||
config.LogLevel = "INFO"
|
config.LogLevel = "INFO"
|
||||||
config.CheckForUpdates = true
|
config.CheckForUpdates = true
|
||||||
config.DefaultPermissions.Exec = true
|
config.DefaultPermissions.Exec = true
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,10 @@ import (
|
||||||
// for both of them.
|
// for both of them.
|
||||||
func StartServers(cfg *config.Config) {
|
func StartServers(cfg *config.Config) {
|
||||||
go startWebUIServer(cfg)
|
go startWebUIServer(cfg)
|
||||||
go startRestAPIServer(cfg)
|
|
||||||
|
|
||||||
if cfg.UseSingleHTTPFrontend {
|
if cfg.UseSingleHTTPFrontend {
|
||||||
StartSingleHTTPFrontend(cfg)
|
go StartSingleHTTPFrontend(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startRestAPIServer(cfg)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,8 @@ func findWebuiDir() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateWebUISettings(w http.ResponseWriter, r *http.Request) {
|
func generateWebUISettings(w http.ResponseWriter, r *http.Request) {
|
||||||
restAddress := ""
|
|
||||||
|
|
||||||
if !cfg.UseSingleHTTPFrontend {
|
|
||||||
restAddress = cfg.ExternalRestAddress
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonRet, _ := json.Marshal(webUISettings{
|
jsonRet, _ := json.Marshal(webUISettings{
|
||||||
Rest: restAddress + "/api/",
|
Rest: cfg.ExternalRestAddress + "/api/",
|
||||||
ThemeName: cfg.ThemeName,
|
ThemeName: cfg.ThemeName,
|
||||||
ShowFooter: cfg.ShowFooter,
|
ShowFooter: cfg.ShowFooter,
|
||||||
ShowNavigation: cfg.ShowNavigation,
|
ShowNavigation: cfg.ShowNavigation,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue