feat: ✨ add config for log level
This commit is contained in:
@@ -30,6 +30,7 @@ type Config struct {
|
||||
|
||||
ReconcileInterval time.Duration
|
||||
DebounceDelay time.Duration
|
||||
LogLevel string
|
||||
|
||||
RecordTTL int
|
||||
CloudflareAutoTTL bool
|
||||
@@ -98,6 +99,13 @@ func LoadConfig() (*Config, error) {
|
||||
return nil, fmt.Errorf("CF_AUTO_TTL: invalid boolean %q: %w", autoTTLStr, err)
|
||||
}
|
||||
|
||||
cfg.LogLevel = strings.ToLower(envOrDefault("LOG_LEVEL", "info"))
|
||||
switch cfg.LogLevel {
|
||||
case "debug", "info", "warn", "error":
|
||||
default:
|
||||
return nil, fmt.Errorf("LOG_LEVEL: invalid value %q (allowed: debug, info, warn, error)", cfg.LogLevel)
|
||||
}
|
||||
|
||||
cfg.ExcludeRouters = make(map[string]struct{})
|
||||
if v := os.Getenv("EXCLUDE_ROUTERS"); v != "" {
|
||||
for _, r := range strings.Split(v, ",") {
|
||||
|
||||
Reference in New Issue
Block a user