fix: ensure JWT secret always has a value
Build and Deploy / build (push) Successful in 2m39s
Build and Deploy / deploy (push) Successful in 9s

This commit is contained in:
2026-07-17 07:28:17 +00:00
parent 8d9d3f79fa
commit 90b12935a4
+6 -1
View File
@@ -89,7 +89,12 @@ func Load(configPath string) error {
return err return err
} }
// 从环境变量读取 JWT Secret // 确保 JWT Secret 有值
if Cfg.JWT.Secret == "" {
Cfg.JWT.Secret = "default-jwt-secret-change-in-production"
}
// 从环境变量读取 JWT Secret(优先级更高)
if secret := os.Getenv("JWT_SECRET"); secret != "" { if secret := os.Getenv("JWT_SECRET"); secret != "" {
Cfg.JWT.Secret = secret Cfg.JWT.Secret = secret
} }