feat: support send ali code
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package ali
|
||||
|
||||
import (
|
||||
"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss"
|
||||
"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss/credentials"
|
||||
"go.ipao.vip/atom/container"
|
||||
"go.ipao.vip/atom/opt"
|
||||
)
|
||||
@@ -34,23 +32,17 @@ func Provide(opts ...opt.Option) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return container.Container.Provide(func() (*OSSClient, error) {
|
||||
cred := credentials.NewStaticCredentialsProvider(config.AccessKeyId, config.AccessKeySecret)
|
||||
return container.Container.Provide(func() (*OSSClient, *SMSNotifyClient, error) {
|
||||
smsClient, err := NewSMSNotifyClient(&config)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
cfg := oss.LoadDefaultConfig().
|
||||
WithCredentialsProvider(cred).
|
||||
WithRegion(config.Region).
|
||||
WithUseCName(true).
|
||||
WithEndpoint(*config.Host)
|
||||
ossClient, err := NewOSSClient(&config)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
cfgInternal := oss.LoadDefaultConfig().
|
||||
WithCredentialsProvider(cred).
|
||||
WithRegion(config.Region)
|
||||
|
||||
return &OSSClient{
|
||||
client: oss.NewClient(cfg),
|
||||
internalClient: oss.NewClient(cfgInternal),
|
||||
config: &config,
|
||||
}, nil
|
||||
return ossClient, smsClient, nil
|
||||
}, o.DiOptions()...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user