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
|
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())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user