mirror of
https://github.com/certimate-go/certimate.git
synced 2026-07-20 21:01:41 +08:00
revise
This commit is contained in:
parent
079b85e9d5
commit
c7bc95679c
@ -104,12 +104,11 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
|
||||
switch d.config.DomainMatchPattern {
|
||||
case "", DOMAIN_MATCH_PATTERN_EXACT:
|
||||
{
|
||||
if d.config.Domain == "" {
|
||||
domain := normalizeDomain(d.config.Domain)
|
||||
if domain == "" {
|
||||
return nil, fmt.Errorf("config `domain` is required")
|
||||
}
|
||||
|
||||
// "*.example.com" → ".example.com",适配阿里云 CDN 要求的泛域名格式
|
||||
domain := strings.TrimPrefix(d.config.Domain, "*")
|
||||
domains = []string{domain}
|
||||
}
|
||||
|
||||
@ -270,3 +269,11 @@ func createSDKClient(accessKeyId, accessKeySecret string) (*alicdn.Client, error
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func normalizeDomain(domain string) string {
|
||||
// "*.example.com" → ".example.com",适配阿里云 CDN 的泛域名参数要求
|
||||
if strings.HasPrefix(domain, "*.") {
|
||||
return strings.TrimPrefix(domain, "*")
|
||||
}
|
||||
return domain
|
||||
}
|
||||
|
||||
@ -104,12 +104,11 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
|
||||
switch d.config.DomainMatchPattern {
|
||||
case "", DOMAIN_MATCH_PATTERN_EXACT:
|
||||
{
|
||||
if d.config.Domain == "" {
|
||||
domain := normalizeDomain(d.config.Domain)
|
||||
if domain == "" {
|
||||
return nil, fmt.Errorf("config `domain` is required")
|
||||
}
|
||||
|
||||
// "*.example.com" → ".example.com",适配阿里云 DCDN 要求的泛域名格式
|
||||
domain := strings.TrimPrefix(d.config.Domain, "*")
|
||||
domains = []string{domain}
|
||||
}
|
||||
|
||||
@ -271,3 +270,11 @@ func createSDKClient(accessKeyId, accessKeySecret string) (*alidcdn.Client, erro
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func normalizeDomain(domain string) string {
|
||||
// "*.example.com" → ".example.com",适配阿里云 DCDN 的泛域名参数要求
|
||||
if strings.HasPrefix(domain, "*.") {
|
||||
return strings.TrimPrefix(domain, "*")
|
||||
}
|
||||
return domain
|
||||
}
|
||||
|
||||
@ -79,12 +79,11 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
|
||||
switch d.config.DomainMatchPattern {
|
||||
case "", DOMAIN_MATCH_PATTERN_EXACT:
|
||||
{
|
||||
if d.config.Domain == "" {
|
||||
domain := normalizeDomain(d.config.Domain)
|
||||
if domain == "" {
|
||||
return nil, fmt.Errorf("config `domain` is required")
|
||||
}
|
||||
|
||||
// "*.example.com" → ".example.com",适配阿里云 Live 要求的泛域名格式
|
||||
domain := strings.TrimPrefix(d.config.Domain, "*")
|
||||
domains = []string{domain}
|
||||
}
|
||||
|
||||
@ -251,3 +250,11 @@ func createSDKClient(accessKeyId, accessKeySecret, region string) (*alilive.Clie
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func normalizeDomain(domain string) string {
|
||||
// "*.example.com" → ".example.com",适配阿里云 Live 的泛域名参数要求
|
||||
if strings.HasPrefix(domain, "*.") {
|
||||
return strings.TrimPrefix(domain, "*")
|
||||
}
|
||||
return domain
|
||||
}
|
||||
|
||||
@ -176,6 +176,9 @@ func createSDKClient(apiToken string) (*baishansdk.Client, error) {
|
||||
}
|
||||
|
||||
func normalizeDomain(domain string) string {
|
||||
// "*.example.com" → ".example.com",适配白山云 CDN 要求的泛域名格式
|
||||
return strings.TrimPrefix(domain, "*")
|
||||
}
|
||||
// "*.example.com" → ".example.com",适配白山云 CDN 的泛域名参数要求
|
||||
if strings.HasPrefix(domain, "*.") {
|
||||
return strings.TrimPrefix(domain, "*")
|
||||
}
|
||||
return domain
|
||||
}
|
||||
|
||||
@ -89,12 +89,11 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
|
||||
switch d.config.DomainMatchPattern {
|
||||
case "", DOMAIN_MATCH_PATTERN_EXACT:
|
||||
{
|
||||
if d.config.Domain == "" {
|
||||
domain := normalizeDomain(d.config.Domain)
|
||||
if domain == "" {
|
||||
return nil, fmt.Errorf("config `domain` is required")
|
||||
}
|
||||
|
||||
// "*.example.com" → ".example.com",适配七牛云 CDN 要求的泛域名格式
|
||||
domain := strings.TrimPrefix(d.config.Domain, "*")
|
||||
domains = []string{domain}
|
||||
}
|
||||
|
||||
@ -232,3 +231,11 @@ func (d *Deployer) updateDomainCertificate(ctx context.Context, domain string, c
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func normalizeDomain(domain string) string {
|
||||
// "*.example.com" → ".example.com",适配七牛云 CDN 的泛域名参数要求
|
||||
if strings.HasPrefix(domain, "*.") {
|
||||
return strings.TrimPrefix(domain, "*")
|
||||
}
|
||||
return domain
|
||||
}
|
||||
|
||||
@ -99,12 +99,11 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
|
||||
switch d.config.DomainMatchPattern {
|
||||
case "", DOMAIN_MATCH_PATTERN_EXACT:
|
||||
{
|
||||
if d.config.Domain == "" {
|
||||
domain := normalizeDomain(d.config.Domain)
|
||||
if domain == "" {
|
||||
return nil, fmt.Errorf("config `domain` is required")
|
||||
}
|
||||
|
||||
// "*.example.com" → ".example.com",适配火山引擎 DCDN 要求的泛域名格式
|
||||
domain := strings.TrimPrefix(d.config.Domain, "*")
|
||||
domains = []string{domain}
|
||||
}
|
||||
|
||||
@ -227,3 +226,11 @@ func createSDKClient(accessKeyId, secretAccessKey, region string) (*vedcdn.DCDN,
|
||||
client := vedcdn.New(session)
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func normalizeDomain(domain string) string {
|
||||
// "*.example.com" → ".example.com",适配火山引擎 DCDN 的泛域名参数要求
|
||||
if strings.HasPrefix(domain, "*.") {
|
||||
return strings.TrimPrefix(domain, "*")
|
||||
}
|
||||
return domain
|
||||
}
|
||||
|
||||
@ -94,9 +94,8 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
|
||||
return nil, fmt.Errorf("config `domains` is required")
|
||||
}
|
||||
|
||||
// "*.example.com" → ".example.com",适配网宿云 CDN 要求的泛域名格式
|
||||
domains = lo.Map(d.config.Domains, func(domain string, _ int) string {
|
||||
return strings.TrimPrefix(domain, "*")
|
||||
return normalizeDomain(domain)
|
||||
})
|
||||
}
|
||||
|
||||
@ -130,3 +129,11 @@ func createSDKClient(accessKeyId, accessKeySecret string) (*wangsucdn.Client, er
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func normalizeDomain(domain string) string {
|
||||
// "*.example.com" → ".example.com",适配网宿云 CDN 的泛域名参数要求
|
||||
if strings.HasPrefix(domain, "*.") {
|
||||
return strings.TrimPrefix(domain, "*")
|
||||
}
|
||||
return domain
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user