mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Merge pull request #15 from mattermost/enviroment-override
Allow for setting of domain with enviroment variable
This commit is contained in:
@@ -217,6 +217,11 @@ func LoadConfig(fileName string) {
|
||||
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)
|
||||
|
||||
Cfg = &config
|
||||
|
||||
@@ -4,9 +4,24 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestConfig(t *testing.T) {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user