Skip to content

Commit

Permalink
fix DefaultTTL()
Browse files Browse the repository at this point in the history
  • Loading branch information
tlimoncelli committed Dec 28, 2024
1 parent 055b5e6 commit 7f8d90b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions models/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type DomainConfig struct {

// Raw user-input from dnsconfig.js that will be processed into RecordConfigs later:
RawRecords []RawRecordConfig `json:"rawrecords,omitempty"`
DefaultTTL uint32 `json:"defaultTTL,omitempty"`

// Pending work to do for each provider. Provider may be a registrar or DSP.
pendingCorrectionsMutex sync.Mutex // Protect pendingCorrections*
Expand Down
1 change: 0 additions & 1 deletion pkg/rtypectl/fromraw.go

This file was deleted.

5 changes: 5 additions & 0 deletions pkg/rtypectl/postprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
func TransformRawRecords(domains []*models.DomainConfig) error {

for _, dc := range domains {
//fmt.Printf("DEBUG: dc.DefaultTTL = %d\n", dc.DefaultTTL)

for _, rawRec := range dc.RawRecords {

Expand All @@ -31,6 +32,10 @@ func TransformRawRecords(domains []*models.DomainConfig) error {
labelFQDN = label + "." + dc.Name
}

if rawRec.TTL == 0 {
rawRec.TTL = dc.DefaultTTL
}

rec := &models.RecordConfig{
Type: rawRec.Type,
TTL: rawRec.TTL,
Expand Down

0 comments on commit 7f8d90b

Please sign in to comment.