fix(cmd): support alternative config paths
This commit is contained in:
parent
7f5782cde5
commit
a103950b96
8
main.go
8
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())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user