Files
mattermost/cmd/platform/init.go
Joram Wilander 97558f6a6e PLT-4938 Add app package and move logic over from api package (#4931)
* Add app package and move logic over from api package

* Change app package functions to return errors

* Move non-api tests into app package

* Fix merge
2017-01-13 13:53:37 -05:00

47 lines
874 B
Go

package main
import (
"fmt"
"github.com/mattermost/platform/api"
"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.LoadConfig(filename)
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" {
api.LoadLicense()
}
}