Skip to content

Commit f059a02

Browse files
committed
override by default, fail if non global
Signed-off-by: Kristoffer Dalby <[email protected]>
1 parent c837a54 commit f059a02

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hscontrol/types/config.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func LoadConfig(path string, isFile bool) error {
288288

289289
viper.SetDefault("dns.magic_dns", true)
290290
viper.SetDefault("dns.base_domain", "")
291-
viper.SetDefault("dns.override_local_dns", false)
291+
viper.SetDefault("dns.override_local_dns", true)
292292
viper.SetDefault("dns.nameservers.global", []string{})
293293
viper.SetDefault("dns.nameservers.split", map[string]string{})
294294
viper.SetDefault("dns.search_domains", []string{})
@@ -419,6 +419,12 @@ func validateServerConfig() error {
419419
)
420420
}
421421

422+
if viper.GetBool("dns.override_local_dns") {
423+
if global := viper.GetStringSlice("dns.nameservers.global"); len(global) == 0 {
424+
errorText += "Fatal config error: dns.nameservers.global must be set when dns.override_local_dns is true\n"
425+
}
426+
}
427+
422428
if errorText != "" {
423429
// nolint
424430
return errors.New(strings.TrimSuffix(errorText, "\n"))

0 commit comments

Comments
 (0)