initial commit

This commit is contained in:
2024-01-13 00:27:56 -06:00
parent 6d3a276bf0
commit 98efa97678
18 changed files with 1392 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
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)
}