Documentation ¶
Overview ¶
Package cmd enables simple management of the backend via CLI
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "vitrnx-goback", Short: "Simple Go Backend for the VitrnX Project", Long: ` `, PreRun: func(cmd *cobra.Command, args []string) { }, PersistentPreRun: func(cmd *cobra.Command, args []string) { if args[0] == "" { cmd.Println("no instance name provided, canot launch Vitrnx Backend") os.Exit(1) } conf.VitrnxInstanceID = args[0] if viper.GetString(conf.KeyEnvType) != "" { conf.Env = viper.GetString(conf.KeyEnvType) } viper.SetConfigName(conf.BaseName) for _, path := range conf.GetKnownConfFolderPaths() { fmt.Println("Adding confing path: " + path) viper.AddConfigPath(path) } err := viper.ReadInConfig() if err != nil { panic(fmt.Errorf("fatal error config file: %s", err)) } }, Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, }
RootCmd represents the base command when called without any subcommands
View Source
var StartCmd = &cobra.Command{ Use: "start", Short: "Start the VitrnX Backend", Long: ``, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { ts := conf.BuildTimestamp if ts == "" { ts = "just now..." } else { ts = "on " + ts } cmd.Print(fmt.Sprintf("\n\n%s - Vitrnx Go Backend v%s (built %s)\n ==> Starting in %s mode.\n\n", conf.VitrnxInstanceID, conf.VitrnxVersion, ts, conf.Env)) gorm.InitGormRepo() auth.ListExistingUsers(nil) mongodb.InitMongoConnection() route.StartRouter() }, }
StartCmd represents the start command
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.