diff options
Diffstat (limited to 'cmd/platform/init.go')
-rw-r--r-- | cmd/platform/init.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/cmd/platform/init.go b/cmd/platform/init.go index b1ed2f3dc..1683c9d49 100644 --- a/cmd/platform/init.go +++ b/cmd/platform/init.go @@ -7,32 +7,34 @@ import ( "github.com/spf13/cobra" ) -func initDBCommandContextCobra(cmd *cobra.Command) error { +func initDBCommandContextCobra(cmd *cobra.Command) (*app.App, error) { config, err := cmd.Flags().GetString("config") if err != nil { - return err + return nil, err } - if err := initDBCommandContext(config); err != nil { + a, err := initDBCommandContext(config) + if err != nil { // Returning an error just prints the usage message, so actually panic panic(err) } - return nil + return a, nil } -func initDBCommandContext(configFileLocation string) error { +func initDBCommandContext(configFileLocation string) (*app.App, error) { if err := utils.InitAndLoadConfig(configFileLocation); err != nil { - return err + return nil, err } utils.ConfigureCmdLineLog() - app.Global().NewServer() - app.Global().InitStores() + a := app.Global() + a.NewServer() + a.InitStores() if model.BuildEnterpriseReady == "true" { - app.Global().LoadLicense() + a.LoadLicense() } - return nil + return a, nil } |