return *gui.BasicWindow

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-06 21:04:31 -06:00
parent 8f34aa62f2
commit 89e740330f
2 changed files with 8 additions and 6 deletions

View File

@ -29,17 +29,17 @@ func Create(zone string, hostname string, value string) bool {
GetZones(key, email) GetZones(key, email)
var z *ConfigT var z *ConfigT
for d, v := range Config { for d, v := range Config {
log.Info("cloudflare.Create() zone =", d, "value =", v) log.Log(INFO, "cloudflare.Create() zone =", d, "value =", v)
if (zone == d) { if (zone == d) {
z = Config[zone] z = Config[zone]
log.Info("cloudflare.Create() FOUND ZONE", zone, "ID =", z.ZoneID) log.Log(INFO, "cloudflare.Create() FOUND ZONE", zone, "ID =", z.ZoneID)
} }
} }
if (z == nil) { if (z == nil) {
log.Warn("cloudflare.Create() COULD NOT FIND ZONE", zone) log.Warn("cloudflare.Create() COULD NOT FIND ZONE", zone)
return false return false
} }
log.Info("cloudflare.Create() FOUND ZONE", z) log.Log(INFO, "cloudflare.Create() FOUND ZONE", z)
// make a json record to send on port 80 to cloudflare // make a json record to send on port 80 to cloudflare
var data string var data string
@ -52,6 +52,6 @@ func Create(zone string, hostname string, value string) bool {
result := doCurlCreate(key, email, z.ZoneID, data) result := doCurlCreate(key, email, z.ZoneID, data)
pretty, _ := FormatJSON(result) pretty, _ := FormatJSON(result)
log.Info("cloudflare.Create() result =", pretty) log.Spew("cloudflare.Create() result =", pretty)
return true return true
} }

6
rr.go
View File

@ -18,12 +18,12 @@ func init() {
Config = make(map[string]*ConfigT) Config = make(map[string]*ConfigT)
} }
func CreateRR(myGui *gui.Node, zone string, zoneID string) { func CreateRR(myGui *gui.Node, zone string, zoneID string) *gadgets.BasicWindow {
if (CFdialog.cloudflareW != nil) { if (CFdialog.cloudflareW != nil) {
// skip this if the window has already been created // skip this if the window has already been created
log.Warn("createRR() the cloudflare window already exists") log.Warn("createRR() the cloudflare window already exists")
CFdialog.cloudflareB.Disable() CFdialog.cloudflareB.Disable()
return return CFdialog.cloudflareW
} }
CFdialog.cloudflareW = gadgets.NewBasicWindow(myGui, "cloudflare " + zone + " API") CFdialog.cloudflareW = gadgets.NewBasicWindow(myGui, "cloudflare " + zone + " API")
@ -149,4 +149,6 @@ func CreateRR(myGui *gui.Node, zone string, zoneID string) {
group.Pad() group.Pad()
grid.Pad() grid.Pad()
grid.Expand() grid.Expand()
return CFdialog.cloudflareW
} }