From a103950b96b36eeb655e933d4360e69868c5218c Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Fri, 11 Mar 2022 10:22:50 +0100 Subject: [PATCH] fix(cmd): support alternative config paths --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 88fe819..8e20c7f 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "os" log "github.com/sirupsen/logrus" @@ -10,7 +11,8 @@ import ( ) var ( - version string + 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()) }