Skip to content

Commit

Permalink
fix tencent cdn deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
usual2970 committed Oct 30, 2024
1 parent 61a4fd8 commit 16967c4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/deployer/tencent_cdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"strings"

"golang.org/x/exp/slices"

cdn "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn/v20180606"
Expand Down Expand Up @@ -111,10 +112,10 @@ func (d *TencentCDNDeployer) deploy(certId string) error {
request.InstanceIdList = common.StringPtrs(list)
} else { // 否则直接使用传入的域名
deployed, _ := d.isDomainDeployed(certId, domain)
if(deployed){
if deployed {
d.infos = append(d.infos, "域名已部署")
return nil
}else{
} else {
request.InstanceIdList = common.StringPtrs([]string{domain})
}
}
Expand Down Expand Up @@ -150,7 +151,7 @@ func (d *TencentCDNDeployer) getDomainList(certId string) ([]string, error) {
domains := make([]string, 0)
for _, domain := range response.Response.Domains {
domainStr := *domain
if(slices.Contains(deployedDomains, domainStr)){
if !slices.Contains(deployedDomains, domainStr) {
domains = append(domains, domainStr)
}
}
Expand All @@ -160,7 +161,7 @@ func (d *TencentCDNDeployer) getDomainList(certId string) ([]string, error) {

func (d *TencentCDNDeployer) isDomainDeployed(certId, domain string) (bool, error) {
deployedDomains, err := d.getDeployedDomainList(certId)
if(err != nil){
if err != nil {
return false, err
}

Expand Down

0 comments on commit 16967c4

Please sign in to comment.