mirror of https://github.com/allinssl/allinssl
修改阿里云ak/sk和bucket取值
parent
45145a2311
commit
25ebe3e88e
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/alibabacloud-go/tea/tea"
|
"github.com/alibabacloud-go/tea/tea"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/aliyun/aliyun-oss-go-sdk/oss"
|
"github.com/aliyun/aliyun-oss-go-sdk/oss"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ func ClientAliCdn(accessKey, accessSecret string) (_result *aliyuncdn.Client, er
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return client, nil
|
return client, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ func DeployAliCdn(cfg map[string]any) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := ClientAliCdn(providerConfig["access_key"], providerConfig["access_secret"])
|
client, err := ClientAliCdn(providerConfig["access_key_id"], providerConfig["access_key_secret"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ func DeployAliCdn(cfg map[string]any) error {
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("证书错误:cert")
|
return fmt.Errorf("证书错误:cert")
|
||||||
}
|
}
|
||||||
|
|
||||||
setCdnDomainSSLCertificateRequest := &aliyuncdn.SetCdnDomainSSLCertificateRequest{
|
setCdnDomainSSLCertificateRequest := &aliyuncdn.SetCdnDomainSSLCertificateRequest{
|
||||||
DomainName: tea.String(domain),
|
DomainName: tea.String(domain),
|
||||||
SSLProtocol: tea.String("on"),
|
SSLProtocol: tea.String("on"),
|
||||||
|
@ -108,12 +108,12 @@ func ClientOss(accessKeyId, accessKeySecret, region string) (*oss.Client, error)
|
||||||
default:
|
default:
|
||||||
endpoint = fmt.Sprintf("oss-%s.aliyuncs.com", region)
|
endpoint = fmt.Sprintf("oss-%s.aliyuncs.com", region)
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := oss.New(endpoint, accessKeyId, accessKeySecret)
|
client, err := oss.New(endpoint, accessKeyId, accessKeySecret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return client, nil
|
return client, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,8 +150,8 @@ func DeployOss(cfg map[string]any) error {
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("参数错误:region")
|
return fmt.Errorf("参数错误:region")
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := ClientOss(providerConfig["access_key"], providerConfig["access_secret"], region)
|
client, err := ClientOss(providerConfig["access_key_id"], providerConfig["access_key_secret"], region)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ func DeployOss(cfg map[string]any) error {
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("参数错误:domain")
|
return fmt.Errorf("参数错误:domain")
|
||||||
}
|
}
|
||||||
bucket, ok := cfg["domain"].(string)
|
bucket, ok := cfg["bucket"].(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("参数错误:bucket")
|
return fmt.Errorf("参数错误:bucket")
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ func DeployOss(cfg map[string]any) error {
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("证书错误:cert")
|
return fmt.Errorf("证书错误:cert")
|
||||||
}
|
}
|
||||||
|
|
||||||
putBucketCnameWithCertificateRequest := oss.PutBucketCname{
|
putBucketCnameWithCertificateRequest := oss.PutBucketCname{
|
||||||
Cname: domain,
|
Cname: domain,
|
||||||
CertificateConfiguration: &oss.CertificateConfiguration{
|
CertificateConfiguration: &oss.CertificateConfiguration{
|
||||||
|
|
Loading…
Reference in New Issue