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:
parent
22a72de719
commit
b8a3ed0e44
1 changed files with 7 additions and 3 deletions
|
|
@ -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() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue