package config import ( "log" "os" "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) } // print running config printRunningConfig(&Cfg, cfgInfo) }