fix version 1
This commit is contained in:
@@ -27,5 +27,5 @@ func NewImpl() {
|
||||
// 初始化 Etcd 客户端
|
||||
EtcdService = with.Etcd(config.Spec.Etcd)
|
||||
// 初始化服务提供商
|
||||
withProvider()
|
||||
InitProvider()
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ func (p *ProviderClient) init() {
|
||||
Provider = &ProviderClient{}
|
||||
}
|
||||
|
||||
func withProvider() {
|
||||
// InitProvider 初始化各服务商客户端,供独立部署(NewImpl)与聚合部署(service.Expose)共用
|
||||
func InitProvider() {
|
||||
Provider.init()
|
||||
for key, conf := range config.Spec.SMTP {
|
||||
switch strings.ToLower(key) {
|
||||
@@ -45,6 +46,12 @@ func withProvider() {
|
||||
Provider.Aliyun = NewAliyun(conf)
|
||||
case "tencent":
|
||||
Provider.Tencent = NewTencent(conf)
|
||||
case "default":
|
||||
// 聚合部署的短信配置只有 default 段,此处作为默认阿里云通道初始化,
|
||||
// 保证请求 provider=aliyun 时可用(显式配置的 aliyun 段优先)。
|
||||
if Provider.Aliyun == nil {
|
||||
Provider.Aliyun = NewAliyun(conf)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user