feat: add cloudflare auto ttl

This commit is contained in:
2026-03-15 19:34:38 +03:00
parent 735e2052e8
commit 4dbe4da184
3 changed files with 27 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ type Config struct {
DebounceDelay time.Duration
RecordTTL int
CloudflareAutoTTL bool
ExcludeRouters map[string]struct{}
}
@@ -83,6 +84,12 @@ func LoadConfig() (*Config, error) {
return nil, fmt.Errorf("RECORD_TTL: invalid integer %q: %w", ttlStr, err)
}
autoTTLStr := envOrDefault("CF_AUTO_TTL", "true")
cfg.CloudflareAutoTTL, err = strconv.ParseBool(autoTTLStr)
if err != nil {
return nil, fmt.Errorf("CF_AUTO_TTL: invalid boolean %q: %w", autoTTLStr, err)
}
cfg.ExcludeRouters = make(map[string]struct{})
if v := os.Getenv("EXCLUDE_ROUTERS"); v != "" {
for _, r := range strings.Split(v, ",") {