1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-04-24 17:22:25 +08:00
parent 11bf46c7e4
commit 0ae65cee45
12 changed files with 132 additions and 75 deletions

View File

@@ -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"`