Skip to content

Commit

Permalink
cleanup debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronhurt committed Jul 12, 2024
1 parent 3fe446b commit 82acd29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 7 additions & 8 deletions command/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package update

import (
// backend definitions
"github.com/leprechau/ipman/internal/dns"
"github.com/leprechau/ipman/internal/ip"
)
Expand Down Expand Up @@ -33,7 +34,6 @@ func (c *Command) checkUpdate(iType ip.IFlag, rType dns.RType) error {
var local, remote, record string
var err error

c.Log.Debug("checking update", "config", c.config)
// get local address
if local, err = c.ip.Get(iType); err != nil {
return err
Expand All @@ -47,15 +47,14 @@ func (c *Command) checkUpdate(iType ip.IFlag, rType dns.RType) error {
c.Log.Debug("successfully queried local and remote addresses", "iType", iType, "local", local, "remote", remote)

// update if needed
// if local != remote {
// attempt to update remote record
if record, err = c.dns.Upsert(c.config.zone, c.config.name, local, rType); err != nil {
return err
if local != remote {
// attempt to update remote record
if record, err = c.dns.Upsert(c.config.zone, c.config.name, local, rType); err != nil {
return err
}
c.Log.Info("updated remote", "record", record, "rType", rType, "data", local)
}

c.Log.Info("updated remote", "record", record, "rType", rType, "data", local)
// }

// all okay
return nil
}
2 changes: 0 additions & 2 deletions internal/dns/cloudflare/cloudflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func (c *Config) Get(zone, name string, typ dns.RType) (string, error) {
SetPathParam("zone", zone).
SetResult(&ZoneResponse{}).
SetError(&DNSErrorResponse{}).
SetDebug(true).
Get("/zones/{zone}"); err != nil {
return "", err
}
Expand All @@ -45,7 +44,6 @@ func (c *Config) Get(zone, name string, typ dns.RType) (string, error) {
SetPathParam("zone", zone).
SetResult(&DNSResponse{}).
SetError(&DNSErrorResponse{}).
SetDebug(true).
Get("/zones/{zone}/dns_records"); err != nil {
return "", err
}
Expand Down

0 comments on commit 82acd29

Please sign in to comment.