mirror of
https://github.com/mattermost/mattermost.git
synced 2026-08-27 05:37:15 -05:00
* Adding viper libs for config file changes * Removing the old fsnotify lib * updating some missing libs * PLT-6076 Read config file info from enviroment vars * Changing unit test to use less important props
48 lines
903 B
Go
48 lines
903 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/mattermost/platform/app"
|
|
"github.com/mattermost/platform/model"
|
|
"github.com/mattermost/platform/utils"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func doLoadConfig(filename string) (err string) {
|
|
defer func() {
|
|
if r := recover(); r != nil {
|
|
err = fmt.Sprintf("%v", r)
|
|
}
|
|
}()
|
|
utils.TranslationsPreInit()
|
|
utils.EnableConfigFromEnviromentVars()
|
|
utils.LoadConfig(filename)
|
|
utils.EnableConfigWatch()
|
|
return ""
|
|
}
|
|
|
|
func initDBCommandContextCobra(cmd *cobra.Command) error {
|
|
config, err := cmd.Flags().GetString("config")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
initDBCommandContext(config)
|
|
|
|
return nil
|
|
}
|
|
|
|
func initDBCommandContext(configFileLocation string) {
|
|
if errstr := doLoadConfig(configFileLocation); errstr != "" {
|
|
return
|
|
}
|
|
|
|
utils.ConfigureCmdLineLog()
|
|
|
|
app.NewServer()
|
|
app.InitStores()
|
|
if model.BuildEnterpriseReady == "true" {
|
|
app.LoadLicense()
|
|
}
|
|
}
|