mirror of
https://github.com/usual2970/certimate.git
synced 2025-08-15 13:51:45 +00:00
feat: add volcengine dns provider and add volcengine live deployer
This commit is contained in:
35
internal/applicant/volcengine.go
Normal file
35
internal/applicant/volcengine.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package applicant
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
volcengineDns "github.com/go-acme/lego/v4/providers/dns/volcengine"
|
||||
"github.com/usual2970/certimate/internal/domain"
|
||||
)
|
||||
|
||||
type volcengine struct {
|
||||
option *ApplyOption
|
||||
}
|
||||
|
||||
func NewVolcengine(option *ApplyOption) Applicant {
|
||||
return &volcengine{
|
||||
option: option,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *volcengine) Apply() (*Certificate, error) {
|
||||
access := &domain.VolcengineAccess{}
|
||||
json.Unmarshal([]byte(a.option.Access), access)
|
||||
|
||||
os.Setenv("VOLC_ACCESSKEY", access.AccessKeyID)
|
||||
os.Setenv("VOLC_SECRETKEY", access.SecretAccessKey)
|
||||
os.Setenv("VOLC_PROPAGATION_TIMEOUT", fmt.Sprintf("%d", a.option.Timeout))
|
||||
dnsProvider, err := volcengineDns.NewDNSProvider()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return apply(a.option, dnsProvider)
|
||||
}
|
Reference in New Issue
Block a user