From f0eca13294b9c86311795126ae79fd013293beaf Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 8 Jan 2021 21:26:28 +0100 Subject: [PATCH] moved chdir after config loaded --- coolDns.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coolDns.go b/coolDns.go index 5196641..c129870 100644 --- a/coolDns.go +++ b/coolDns.go @@ -384,16 +384,16 @@ func main() { configPath := flag.String("c", "/etc/cool-dns/config.yaml", "path to the config file") flag.Parse() - err := os.Chdir(filepath.Dir(*configPath)) - if err != nil { - log.Fatalf("Failed to goto config dir: %s", err.Error()) - } - config, err := loadConfig(*configPath) if err != nil { log.Fatalf("Failed to load config: %s\n", err.Error()) } + err = os.Chdir(filepath.Dir(*configPath)) + if err != nil { + log.Fatalf("Failed to goto config dir: %s", err.Error()) + } + zones, err := loadZones(config.Zones) if err != nil { log.Fatalf("Failed to load zones: %s\n", err.Error())