feat: set default region when applying certificates by huaweicloud

This commit is contained in:
Fu Diwei 2024-10-21 15:10:14 +08:00
parent 908d33f186
commit 18a7bf0d66
2 changed files with 7 additions and 2 deletions

View File

@ -24,7 +24,12 @@ func (t *huaweicloud) Apply() (*Certificate, error) {
access := &domain.HuaweiCloudAccess{}
json.Unmarshal([]byte(t.option.Access), access)
os.Setenv("HUAWEICLOUD_REGION", access.Region) // 华为云的 SDK 要求必须传一个区域,实际上 DNS-01 流程里用不到,但不传会报错
region := access.Region
if region == "" {
region = "cn-north-1"
}
os.Setenv("HUAWEICLOUD_REGION", region) // 华为云的 SDK 要求必须传一个区域,实际上 DNS-01 流程里用不到,但不传会报错
os.Setenv("HUAWEICLOUD_ACCESS_KEY_ID", access.AccessKeyId)
os.Setenv("HUAWEICLOUD_SECRET_ACCESS_KEY", access.SecretAccessKey)
os.Setenv("HUAWEICLOUD_PROPAGATION_TIMEOUT", fmt.Sprintf("%d", t.option.Timeout))

View File

@ -122,7 +122,7 @@ func (d *HuaweiCloudCDNDeployer) createClient(region, accessKeyId, secretAccessK
}
if region == "" {
region = "cn-north-1" // CDN 服务默认区域:华北北京
region = "cn-north-1" // CDN 服务默认区域:华北北京
}
hcRegion, err := cdnRegion.SafeValueOf(region)