feat: 添加YMT密钥解密密钥配置项

在配置文件中新增ymt_key_decrypt_key_b64字段,用于设置YMT密钥解密密钥
当配置项不为空时,自动将其设置为环境变量YMT_KEY_DECRYPT_KEY_B64
This commit is contained in:
zhouyonggao 2025-11-28 14:47:30 +08:00
parent 7170991166
commit e24b42fe4d
3 changed files with 7 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import (
"marketing-system-data-tool/server/internal/logging" "marketing-system-data-tool/server/internal/logging"
"net/http" "net/http"
"time" "time"
"os"
) )
func main() { func main() {
@ -51,3 +52,4 @@ func main() {
} }
// buildDSN deprecated; use cfg.YMTDB.DSN()/cfg.MarketingDB.DSN() // buildDSN deprecated; use cfg.YMTDB.DSN()/cfg.MarketingDB.DSN()
if cfg.YMTKeyDecryptKeyB64 != "" { os.Setenv("YMT_KEY_DECRYPT_KEY_B64", cfg.YMTKeyDecryptKeyB64) }

View File

@ -12,3 +12,4 @@ app:
user: "YOUR_YMT_DB_USER" user: "YOUR_YMT_DB_USER"
password: "YOUR_YMT_DB_PASSWORD" password: "YOUR_YMT_DB_PASSWORD"
name: "YOUR_YMT_DB_NAME" name: "YOUR_YMT_DB_NAME"
ymt_key_decrypt_key_b64: ""

View File

@ -21,6 +21,7 @@ type App struct {
Port string `yaml:"port"` Port string `yaml:"port"`
MarketingDB DB `yaml:"marketing_db"` MarketingDB DB `yaml:"marketing_db"`
YMTDB DB `yaml:"ymt_db"` YMTDB DB `yaml:"ymt_db"`
YMTKeyDecryptKeyB64 string `yaml:"ymt_key_decrypt_key_b64"`
} }
type root struct { type root struct {