mirror of
https://github.com/usual2970/certimate.git
synced 2025-08-13 04:41:46 +00:00
.github
.vscode
docker
internal
applicant
aliyun.go
applicant.go
aws.go
cloudflare.go
godaddy.go
httpreq.go
huaweicloud.go
namesilo.go
pdns.go
tencent.go
deployer
domain
domains
notify
pkg
repository
rest
routes
utils
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
37 lines
746 B
Go
37 lines
746 B
Go
package applicant
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/go-acme/lego/v4/providers/dns/alidns"
|
|
|
|
"github.com/usual2970/certimate/internal/domain"
|
|
)
|
|
|
|
type aliyun struct {
|
|
option *ApplyOption
|
|
}
|
|
|
|
func NewAliyun(option *ApplyOption) Applicant {
|
|
return &aliyun{
|
|
option: option,
|
|
}
|
|
}
|
|
|
|
func (a *aliyun) Apply() (*Certificate, error) {
|
|
access := &domain.AliyunAccess{}
|
|
json.Unmarshal([]byte(a.option.Access), access)
|
|
|
|
os.Setenv("ALICLOUD_ACCESS_KEY", access.AccessKeyId)
|
|
os.Setenv("ALICLOUD_SECRET_KEY", access.AccessKeySecret)
|
|
os.Setenv("ALICLOUD_PROPAGATION_TIMEOUT", fmt.Sprintf("%d", a.option.Timeout))
|
|
dnsProvider, err := alidns.NewDNSProvider()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return apply(a.option, dnsProvider)
|
|
}
|