fix(cmd): support alternative config paths

This commit is contained in:
Markus Pesch 2022-03-11 10:22:50 +01:00
parent 7f5782cde5
commit a103950b96
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"flag"
"os" "os"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
@ -10,7 +11,8 @@ import (
) )
var ( var (
version string version string
configPath string
) )
func main() { func main() {
@ -41,9 +43,11 @@ func main() {
}) })
} }
flag.StringVar(&configPath, "config", "/etc/dyndns-client/config.json", "Path to json config")
log.Infof("version %v", version) log.Infof("version %v", version)
cnf, err := config.Read("/etc/dyndns-client/config.json") cnf, err := config.Read(configPath)
if err != nil { if err != nil {
log.Fatal(err.Error()) log.Fatal(err.Error())
} }