feat(v2): 账户配置注册表(config.accounts + env 取凭证 + 渠道/区域筛选)

This commit is contained in:
wangjia
2026-07-10 08:25:01 +08:00
parent 6a53d7e008
commit 5aecb18d7c
3 changed files with 84 additions and 0 deletions
+16
View File
@@ -16,6 +16,22 @@ type Config struct {
QuerySync QuerySyncConfig `mapstructure:"query_sync"`
// Biz 通用:任意业务系统(jiu / dudu / …)在 config 的 biz.<name> 下声明即可接入,无需改代码。
Biz map[string]BizSystemConfig `mapstructure:"biz"`
// Accounts 多账户配置注册表(v2):凭证不写死配置,只存 env 前缀,真值运行时从环境变量取。
Accounts []AccountConfig `mapstructure:"accounts"`
}
// AccountConfig 单个收款账户的配置(v2 多账户路由用)。凭证严禁写进 config.yaml
// 只存 CredentialEnvPrefix,真值由 internal/accounts.Registry 运行时从环境变量
// `<CredentialEnvPrefix>_<KEY>` 读取。
type AccountConfig struct {
AccountID string `mapstructure:"account_id"`
Channel string `mapstructure:"channel"`
Weight int `mapstructure:"weight"`
Enabled bool `mapstructure:"enabled"`
DailyLimit int64 `mapstructure:"daily_limit"`
Region string `mapstructure:"region"`
Subject string `mapstructure:"subject"`
CredentialEnvPrefix string `mapstructure:"credential_env_prefix"`
}
type ServerConfig struct {