Allow for setting of domain with enviroment variable
Этот коммит содержится в:
@@ -217,6 +217,11 @@ func LoadConfig(fileName string) {
|
|||||||
panic("Error decoding configuration " + err.Error())
|
panic("Error decoding configuration " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Grabs the domain from enviroment variable if not in configuration
|
||||||
|
if config.ServiceSettings.Domain == "" {
|
||||||
|
config.ServiceSettings.Domain = os.Getenv("MATTERMOST_DOMAIN")
|
||||||
|
}
|
||||||
|
|
||||||
configureLog(config.LogSettings)
|
configureLog(config.LogSettings)
|
||||||
|
|
||||||
Cfg = &config
|
Cfg = &config
|
||||||
|
|||||||
@@ -4,9 +4,24 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConfig(t *testing.T) {
|
func TestConfig(t *testing.T) {
|
||||||
LoadConfig("config.json")
|
LoadConfig("config.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEnvOverride(t *testing.T) {
|
||||||
|
os.Setenv("MATTERMOST_DOMAIN", "testdomain.com")
|
||||||
|
|
||||||
|
LoadConfig("config_docker.json")
|
||||||
|
if Cfg.ServiceSettings.Domain != "testdomain.com" {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadConfig("config.json")
|
||||||
|
if Cfg.ServiceSettings.Domain == "testdomain.com" {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user