fix: init config failed

This commit is contained in:
k0a1a 2022-02-24 21:50:12 +08:00
parent 814b109407
commit 0bd6a42350

View file

@ -107,8 +107,7 @@ func Execute() {
// Boot 设定配置 // Boot 设定配置
func Boot() { func Boot() {
root := config.Conf.Root
root := ""
if appPath != "" { if appPath != "" {
r, err := filepath.Abs(appPath) r, err := filepath.Abs(appPath)
if err != nil { if err != nil {
@ -116,16 +115,16 @@ func Boot() {
} }
root = r root = r
} }
if envFile != "" {
if envFile == "" { config.Conf = config.LoadFrom(envFile)
} else {
config.Conf = config.LoadFrom(filepath.Join(root, ".env")) config.Conf = config.LoadFrom(filepath.Join(root, ".env"))
} }
if root != "" {
config.Conf.Root = root
}
if config.Conf.Mode == "production" { if config.Conf.Mode == "production" {
config.Production() config.Production()
} else if config.Conf.Mode == "development" { } else if config.Conf.Mode == "development" {
config.Development() config.Development()
} }
fmt.Println(root)
} }