- 优化
continuous-integration/drone/push Build is failing Details

master
李光春 2 years ago
parent cc033253ea
commit 97d8147d53

@ -5,23 +5,32 @@ import (
"io" "io"
) )
// AliYun 阿里云 // AliYunConfig 阿里云配置
type AliYun struct { type AliYunConfig struct {
AccessKeyId string AccessKeyId string
AccessKeySecret string AccessKeySecret string
Endpoint string Endpoint string
BucketName string BucketName string
error error // 错误信息 }
client *oss.Client // 驱动
bucket *oss.Bucket // 存储空间 // AliYun 阿里云
type AliYun struct {
AliYunConfig
error error // 错误信息
client *oss.Client // 驱动
bucket *oss.Bucket // 存储空间
} }
// NewAliYun 初始化 // NewAliYun 初始化
// https://help.aliyun.com/document_detail/32144.html // https://help.aliyun.com/document_detail/32144.html
func NewAliYun(accessKeyId, accessKeySecret, endpoint, bucketName string) *AliYun { func NewAliYun(config *AliYunConfig) *AliYun {
app := &AliYun{AccessKeyId: accessKeyId, AccessKeySecret: accessKeySecret, Endpoint: endpoint, BucketName: bucketName} app := &AliYun{}
app.client, app.error = oss.New(endpoint, accessKeyId, accessKeySecret) app.AccessKeyId = config.AccessKeyId
app.bucket, app.error = app.client.Bucket(bucketName) app.AccessKeySecret = config.AccessKeySecret
app.Endpoint = config.Endpoint
app.BucketName = config.BucketName
app.client, app.error = oss.New(app.Endpoint, app.AccessKeyId, app.AccessKeySecret)
app.bucket, app.error = app.client.Bucket(app.BucketName)
return app return app
} }

Loading…
Cancel
Save