package config import ( "log" "os" "os/exec" "time" ) var Cfg Config func Init() { Cfg = New() cfgInfo, err := getStructInfo(&Cfg) if err != nil { log.Fatalf("Unable to initialize program: %v", err) } // get command line flags if err := Cfg.parseFlags(cfgInfo); err != nil { log.Fatalf("Unable to initialize program: %v", err) } // set logging Level setLogLevel(&Cfg) // set timezone & time format Cfg.TZUTC, _ = time.LoadLocation("UTC") Cfg.TZLocal, err = time.LoadLocation(Cfg.TimeZoneLocal) if err != nil { Cfg.Log.Error("Unable to parse timezone string", "error", err) os.Exit(1) } // check to see if nsupdate is installed cmd := "command -v nsupdate" if err := exec.Command("/usr/bin/env", "sh", "-c", cmd).Run(); err != nil { panic("nsupdate is not installed") } // print running config printRunningConfig(&Cfg, cfgInfo) }