mirror of
https://github.com/usual2970/certimate.git
synced 2025-08-23 09:41:46 +00:00
.github
.vscode
docker
internal
app
applicant
acmehttpreq.go
aliyun.go
applicant.go
aws.go
cloudflare.go
godaddy.go
huaweicloud.go
namedotcom.go
namesilo.go
powerdns.go
tencentcloud.go
volcengine.go
certificate
deployer
domain
notify
pkg
repository
rest
routes
scheduler
statistics
workflow
migrations
ui
.dockerignore
.editorconfig
.gitignore
.goreleaser.yml
CHANGELOG.md
CONTRIBUTING.md
CONTRIBUTING_EN.md
Dockerfile
LICENSE.md
Makefile
README.md
README_EN.md
go.mod
go.sum
main.go
nixpacks.toml
usage.gif
40 lines
890 B
Go
40 lines
890 B
Go
package applicant
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
|
|
"github.com/go-acme/lego/v4/providers/dns/tencentcloud"
|
|
|
|
"github.com/usual2970/certimate/internal/domain"
|
|
)
|
|
|
|
type tencentcloudApplicant struct {
|
|
option *ApplyOption
|
|
}
|
|
|
|
func NewTencentCloudApplicant(option *ApplyOption) Applicant {
|
|
return &tencentcloudApplicant{
|
|
option: option,
|
|
}
|
|
}
|
|
|
|
func (a *tencentcloudApplicant) Apply() (*Certificate, error) {
|
|
access := &domain.TencentCloudAccessConfig{}
|
|
json.Unmarshal([]byte(a.option.AccessConfig), access)
|
|
|
|
config := tencentcloud.NewDefaultConfig()
|
|
config.SecretID = access.SecretId
|
|
config.SecretKey = access.SecretKey
|
|
if a.option.PropagationTimeout != 0 {
|
|
config.PropagationTimeout = time.Duration(a.option.PropagationTimeout) * time.Second
|
|
}
|
|
|
|
provider, err := tencentcloud.NewDNSProviderConfig(config)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return apply(a.option, provider)
|
|
}
|