nsupdate
This commit is contained in:
@@ -30,6 +30,12 @@ type Config struct {
|
||||
// cisa
|
||||
RemoteURL string `default:"https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json?sort_by=field_date_added" env:"remote_url"`
|
||||
RefreshSeconds int `default:"14400" env:"refresh_seconds"`
|
||||
|
||||
// nsupdate
|
||||
NSUKey string `env:"nsupdate-key" secret:"true"`
|
||||
NSUPort int `default:"53" env:"nsupdate-port"`
|
||||
NSUServer string `default:"ns1.example.com" env:"nsupdate-server"`
|
||||
NSUZone string `default:"example.com" env:"nsupdate-zone"`
|
||||
}
|
||||
|
||||
// New initializes the config variable for use with a prepared set of defaults.
|
||||
@@ -70,16 +76,20 @@ func setLogLevel(cfg *Config) {
|
||||
|
||||
func printRunningConfig(cfg *Config, cfgInfo []structInfo) {
|
||||
for _, info := range cfgInfo {
|
||||
switch info.Type.String() {
|
||||
case "string":
|
||||
p := reflect.ValueOf(cfg).Elem().FieldByName(info.Name).Addr().Interface().(*string)
|
||||
cfg.Log.Debug("Running Configuration", info.Alt, *p)
|
||||
case "bool":
|
||||
p := reflect.ValueOf(cfg).Elem().FieldByName(info.Name).Addr().Interface().(*bool)
|
||||
cfg.Log.Debug("Running Configuration", info.Alt, strconv.FormatBool(*p))
|
||||
case "int":
|
||||
p := reflect.ValueOf(cfg).Elem().FieldByName(info.Name).Addr().Interface().(*int)
|
||||
cfg.Log.Debug("Running Configuration", info.Alt, strconv.FormatInt(int64(*p), 10))
|
||||
if info.Secret {
|
||||
cfg.Log.Debug("Running Configuration", info.Alt, "REDACTED")
|
||||
} else {
|
||||
switch info.Type.String() {
|
||||
case "string":
|
||||
p := reflect.ValueOf(cfg).Elem().FieldByName(info.Name).Addr().Interface().(*string)
|
||||
cfg.Log.Debug("Running Configuration", info.Alt, *p)
|
||||
case "bool":
|
||||
p := reflect.ValueOf(cfg).Elem().FieldByName(info.Name).Addr().Interface().(*bool)
|
||||
cfg.Log.Debug("Running Configuration", info.Alt, strconv.FormatBool(*p))
|
||||
case "int":
|
||||
p := reflect.ValueOf(cfg).Elem().FieldByName(info.Name).Addr().Interface().(*int)
|
||||
cfg.Log.Debug("Running Configuration", info.Alt, strconv.FormatInt(int64(*p), 10))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user