diff --git a/i18n/en.json b/i18n/en.json index bfcfe845e7..b1087b8fbd 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -2019,6 +2019,10 @@ "id": "mattermost.config_file", "translation": "Loaded config file from %v" }, + { + "id": "mattermost.unable_to_load_config", + "translation": "Unable to load mattermost configuration file:" + }, { "id": "mattermost.current_version", "translation": "Current version is %v (%v/%v/%v)" diff --git a/mattermost.go b/mattermost.go index 647899b587..172c42aa15 100644 --- a/mattermost.go +++ b/mattermost.go @@ -60,12 +60,25 @@ var flagTeamName string var flagRole string var flagRunCmds bool +func doLoadConfig(filename string) (err string) { + defer func() { + if r := recover(); r != nil { + err = r.(string) + } + }() + utils.LoadConfig(filename) + return "" +} + func main() { parseCmds() utils.InitTranslations() - utils.LoadConfig(flagConfigFile) + if errstr := doLoadConfig(flagConfigFile); errstr != "" { + l4g.Exit(utils.T("mattermost.unable_to_load_config"), errstr) + return + } if flagRunCmds { utils.ConfigureCmdLineLog() @@ -91,8 +104,7 @@ func main() { if !utils.IsLicensed && len(utils.Cfg.SqlSettings.DataSourceReplicas) > 1 { l4g.Critical(utils.T("store.sql.read_replicas_not_licensed.critical")) - time.Sleep(time.Second) - panic(fmt.Sprintf(utils.T("store.sql.read_replicas_not_licensed.critical"))) + return } if flagRunCmds {