Skip to content

Commit fd0227b

Browse files
committed
update zone id env
1 parent b7d10ba commit fd0227b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dns/cloudflare.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,23 @@ func NewCloudFlare(key, email string, logger contract.Logger) (*CloudFlare, erro
3232
func (c *CloudFlare) getZone(ctx context.Context, domain string) (*cloudflare.Zone, error) {
3333
zones, err := c.client.ListZones(ctx)
3434
if err != nil {
35+
slog.Error("list zones error", "err", err)
3536
return nil, err
3637
}
3738

3839
for _, z := range zones {
3940
if strings.Contains(domain, z.Name) {
41+
slog.Info("get zone success", "zone", z.Name, "id", z.ID)
4042
return &z, nil
4143
}
4244
}
4345
return nil, fmt.Errorf("not found zone")
4446
}
4547

4648
func (c *CloudFlare) GetDomainZoneID(domain string) (string, error) {
47-
var domainID = os.Getenv("CF_DOMAIN_ID")
48-
if domainID != "" {
49-
return domainID, nil
49+
var zoneID = os.Getenv("CF_ZONE_ID")
50+
if zoneID != "" {
51+
return zoneID, nil
5052
}
5153
zone, err := c.getZone(context.Background(), domain)
5254
if err != nil {

0 commit comments

Comments
 (0)