Skip to content

Commit

Permalink
support token
Browse files Browse the repository at this point in the history
  • Loading branch information
orvice committed Aug 16, 2023
1 parent faac986 commit a25ec26
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dns/cloudflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ func NewCloudFlare(key, email string, logger contract.Logger) (*CloudFlare, erro
if err != nil {
return nil, err
}

token := os.Getenv("CF_TOKEN")
if token != "" {
slog.Info("cf use token")
client, err = cloudflare.NewWithAPIToken(token)
if err != nil {
return nil, err
}
}

return &CloudFlare{
client: client,
logger: logger,
Expand Down

0 comments on commit a25ec26

Please sign in to comment.