1
0
Fork 0
mirror of https://gitlab.com/pnx-tools/dns-updater.git synced 2026-06-16 05:54:56 +02:00

cmd/dnsupdater/main.go: Add cli flag for config file path

This commit is contained in:
Henrik Hautakoski 2024-01-14 12:14:01 +01:00
parent 22a72de719
commit b8a3ed0e44

View file

@ -1,6 +1,7 @@
package main
import (
"flag"
"os"
"time"
@ -11,14 +12,18 @@ import (
)
func main() {
configFile := flag.String("config", "./config.yml", "configuration file")
flag.Parse()
log.Logger = log.Output(zerolog.ConsoleWriter{
Out: os.Stderr,
TimeFormat: time.RFC3339,
})
config, err := app.LoadConfig("config.yml")
config, err := app.LoadConfig(*configFile)
if err != nil {
log.Fatal().Err(err).Msg("Failed to load config")
log.Fatal().Err(err).Str("file", *configFile).Msg("Failed to load config")
}
app, err := app.NewApp(config)
@ -59,6 +64,5 @@ func main() {
}
}
}
}
}