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
import (
"flag"
"os"
log "github.com/sirupsen/logrus"
@ -11,6 +12,7 @@ import (
var (
version string
configPath string
)
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)
cnf, err := config.Read("/etc/dyndns-client/config.json")
cnf, err := config.Read(configPath)
if err != nil {
log.Fatal(err.Error())
}