mirror of
https://github.com/beego/bee.git
synced 2025-06-11 03:10:40 +00:00
Load configuration for all commands
This removes the filepath.Walk() when loading configuration, as it can read a Beefile from another project in the $GOPATH. Now config.LoadConfig() is called for all available commands.
This commit is contained in:
@ -42,11 +42,8 @@ var CmdBale = &commands.Command{
|
||||
It will auto-generate an unpack function to the main package then run it during the runtime.
|
||||
This is mainly used for zealots who are requiring 100% Go code.
|
||||
`,
|
||||
PreRun: func(cmd *commands.Command, args []string) {
|
||||
version.ShowShortVersionBanner()
|
||||
config.LoadConfig()
|
||||
},
|
||||
Run: runBale,
|
||||
PreRun: func(cmd *commands.Command, args []string) { version.ShowShortVersionBanner() },
|
||||
Run: runBale,
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -117,8 +117,6 @@ func scaffold(cmd *commands.Command, args []string, currpath string) {
|
||||
beeLogger.Log.Fatal("Wrong number of arguments. Run: bee help generate")
|
||||
}
|
||||
|
||||
config.LoadConfig()
|
||||
|
||||
cmd.Flag.Parse(args[2:])
|
||||
if generate.SQLDriver == "" {
|
||||
generate.SQLDriver = utils.DocValue(config.Conf.Database.Driver)
|
||||
@ -141,8 +139,6 @@ func scaffold(cmd *commands.Command, args []string, currpath string) {
|
||||
}
|
||||
|
||||
func appCode(cmd *commands.Command, args []string, currpath string) {
|
||||
config.LoadConfig()
|
||||
|
||||
cmd.Flag.Parse(args[1:])
|
||||
if generate.SQLDriver == "" {
|
||||
generate.SQLDriver = utils.DocValue(config.Conf.Database.Driver)
|
||||
|
@ -52,11 +52,8 @@ var CmdMigrate = &commands.Command{
|
||||
|
||||
$ bee migrate refresh [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"]
|
||||
`,
|
||||
PreRun: func(cmd *commands.Command, args []string) {
|
||||
version.ShowShortVersionBanner()
|
||||
config.LoadConfig()
|
||||
},
|
||||
Run: RunMigration,
|
||||
PreRun: func(cmd *commands.Command, args []string) { version.ShowShortVersionBanner() },
|
||||
Run: RunMigration,
|
||||
}
|
||||
|
||||
var mDriver utils.DocValue
|
||||
|
@ -34,11 +34,8 @@ var CmdRun = &commands.Command{
|
||||
Run command will supervise the filesystem of the application for any changes, and recompile/restart it.
|
||||
|
||||
`,
|
||||
PreRun: func(cmd *commands.Command, args []string) {
|
||||
version.ShowShortVersionBanner()
|
||||
config.LoadConfig()
|
||||
},
|
||||
Run: RunApp,
|
||||
PreRun: func(cmd *commands.Command, args []string) { version.ShowShortVersionBanner() },
|
||||
Run: RunApp,
|
||||
}
|
||||
|
||||
var (
|
||||
|
Reference in New Issue
Block a user