Skip to content

Commit

Permalink
Merge pull request #225 from PBK-B/fix_dcdn_wildcard
Browse files Browse the repository at this point in the history
fix: handle aliyun dcdn does not support wildcard domain #223
  • Loading branch information
usual2970 authored Oct 20, 2024
2 parents 0037659 + 0d07c7c commit 84e2fd4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/deployer/aliyun_esa.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/*
* @Author: Bin
* @Date: 2024-09-17
* @FilePath: /github.com/usual2970/certimate/internal/deployer/aliyun_esa.go
* @FilePath: /certimate/internal/deployer/aliyun_esa.go
*/
package deployer

import (
"context"
"encoding/json"
"fmt"
"strings"

openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
dcdn20180115 "github.com/alibabacloud-go/dcdn-20180115/v3/client"
Expand Down Expand Up @@ -55,8 +56,15 @@ func (d *AliyunESADeployer) GetInfo() []string {

func (d *AliyunESADeployer) Deploy(ctx context.Context) error {
certName := fmt.Sprintf("%s-%s-%s", d.option.Domain, d.option.DomainId, rand.RandStr(6))

// 支持泛解析域名,在 Aliyun DCND 中泛解析域名表示为 .example.com
domain := getDeployString(d.option.DeployConfig, "domain")
if strings.HasPrefix(domain, "*") {
domain = strings.TrimPrefix(domain, "*")
}

setDcdnDomainSSLCertificateRequest := &dcdn20180115.SetDcdnDomainSSLCertificateRequest{
DomainName: tea.String(getDeployString(d.option.DeployConfig, "domain")),
DomainName: tea.String(domain),
CertName: tea.String(certName),
CertType: tea.String("upload"),
SSLProtocol: tea.String("on"),
Expand Down

0 comments on commit 84e2fd4

Please sign in to comment.