fix: 修复YMT密钥解密环境变量设置位置错误

将YMT_KEY_DECRYPT_KEY_B64环境变量设置从文件末尾移至main函数开始处
确保在日志初始化前完成环境变量配置
This commit is contained in:
zhouyonggao 2025-11-28 14:47:58 +08:00
parent e24b42fe4d
commit 830fb574e6
1 changed files with 1 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import (
func main() {
cfg := config.Load()
if cfg.YMTKeyDecryptKeyB64 != "" { os.Setenv("YMT_KEY_DECRYPT_KEY_B64", cfg.YMTKeyDecryptKeyB64) }
_ = logging.Init("log")
log.Println("connecting YMT MySQL:", cfg.YMTDB.Host+":"+cfg.YMTDB.Port, "db", cfg.YMTDB.Name, "user", cfg.YMTDB.User)
log.Println("connecting Marketing MySQL:", cfg.MarketingDB.Host+":"+cfg.MarketingDB.Port, "db", cfg.MarketingDB.Name, "user", cfg.MarketingDB.User)
@ -52,4 +53,3 @@ func main() {
}
// buildDSN deprecated; use cfg.YMTDB.DSN()/cfg.MarketingDB.DSN()
if cfg.YMTKeyDecryptKeyB64 != "" { os.Setenv("YMT_KEY_DECRYPT_KEY_B64", cfg.YMTKeyDecryptKeyB64) }