Skip to content

Commit

Permalink
domain id from env
Browse files Browse the repository at this point in the history
  • Loading branch information
orvice committed Aug 16, 2023
1 parent f33600f commit 2ae80b7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dns/cloudflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package dns
import (
"context"
"fmt"
"os"

"github.com/cloudflare/cloudflare-go"
"github.com/orvice/ddns/config"
"github.com/orvice/ddns/notify"
Expand All @@ -27,6 +29,10 @@ func NewCloudFlare(key, email string, logger contract.Logger) (*CloudFlare, erro
}

func (c *CloudFlare) GetDomainZoneID(domain string) (string, error) {
var domainID = os.Getenv("CF_DOMAIN_ID")
if domainID != "" {
return domainID, nil
}
zone := utils.GetDomainSuffix(domain)
id, err := c.client.ZoneIDByName(zone)
if err != nil {
Expand Down

0 comments on commit 2ae80b7

Please sign in to comment.