feat: integrate unified payment and wallet refunds
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Package config 沿用 sample/server 的 BSM 运行配置与地址校验。
|
||||
// Package config 使用仓库统一的 BSM 运行配置与地址校验。
|
||||
package config
|
||||
|
||||
import (
|
||||
@@ -12,10 +12,18 @@ var Spec SrvConfig
|
||||
|
||||
// SrvConfig 保持与 API 进程相同的 BSM 配置结构。
|
||||
type SrvConfig struct {
|
||||
conf.Base `yaml:",inline"`
|
||||
Databases *conf.DBConf `yaml:"Databases"`
|
||||
Rpc map[string]conf.RpcConf `yaml:"Rpc"`
|
||||
Apm *conf.ApmConf `yaml:"APM"`
|
||||
conf.Base `yaml:",inline"`
|
||||
Databases *conf.DBConf `yaml:"Databases"`
|
||||
Rpc map[string]conf.RpcConf `yaml:"Rpc"`
|
||||
Apm *conf.ApmConf `yaml:"APM"`
|
||||
PaymentAPI PaymentAPIConfig `yaml:"PaymentAPI"`
|
||||
}
|
||||
|
||||
// PaymentAPIConfig 保存 Worker 调用支付内部动作所需的最小配置。
|
||||
type PaymentAPIConfig struct {
|
||||
BaseURL string `yaml:"BaseURL"`
|
||||
Token string `yaml:"Token"`
|
||||
IntervalSeconds int `yaml:"IntervalSeconds"`
|
||||
}
|
||||
|
||||
// New 初始化 Worker 配置。
|
||||
@@ -25,5 +33,8 @@ func New(srvKey string) {
|
||||
Spec.BindIP = conf.CheckIP(Spec.BindIP)
|
||||
Spec.Addr = net.JoinHostPort(Spec.BindIP, Spec.Port)
|
||||
conf.NotNil(Spec.Service, Spec.Cache)
|
||||
if Spec.PaymentAPI.BaseURL == "" || Spec.PaymentAPI.Token == "" || Spec.PaymentAPI.IntervalSeconds <= 0 {
|
||||
panic("PaymentAPI configuration is required")
|
||||
}
|
||||
conf.PrintInfo(Spec.Addr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user