fix: init config failed
This commit is contained in:
parent
814b109407
commit
0bd6a42350
1 changed files with 6 additions and 7 deletions
13
cmd/root.go
13
cmd/root.go
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue