This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package coolconfig
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
@@ -72,7 +74,7 @@ type file struct {
|
||||
func newConfig() *sConfig {
|
||||
var ctx g.Ctx
|
||||
config := &sConfig{
|
||||
AutoMigrate: GetCfgWithDefault(ctx, "blazing.autoMigrate", g.NewVar(false)).Bool(),
|
||||
AutoMigrate: hasDebugArg(),
|
||||
Name: GetCfgWithDefault(ctx, "server.name", g.NewVar("")).String(),
|
||||
|
||||
Eps: GetCfgWithDefault(ctx, "blazing.eps", g.NewVar(false)).Bool(),
|
||||
@@ -97,6 +99,19 @@ func newConfig() *sConfig {
|
||||
return config
|
||||
}
|
||||
|
||||
func hasDebugArg() bool {
|
||||
for _, arg := range os.Args[1:] {
|
||||
if arg == "-debug" || arg == "--debug" {
|
||||
return true
|
||||
}
|
||||
if strings.HasPrefix(arg, "-debug=") || strings.HasPrefix(arg, "--debug=") {
|
||||
value := strings.TrimSpace(strings.SplitN(arg, "=", 2)[1])
|
||||
return value != "" && value != "0" && !strings.EqualFold(value, "false")
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// qiniu 七牛云配置
|
||||
type qiniu struct {
|
||||
AccessKey string `json:"ak"`
|
||||
|
||||
Reference in New Issue
Block a user