From e62cfa8c840e549d69ec85483ccac4f23ef7fd6e Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 27 May 2018 12:31:35 -0500 Subject: [PATCH] revert removal of useconffile --- yggdrasil.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/yggdrasil.go b/yggdrasil.go index 9b5ee631..91403bba 100644 --- a/yggdrasil.go +++ b/yggdrasil.go @@ -123,7 +123,8 @@ func doGenconf() string { var pprof = flag.Bool("pprof", false, "Run pprof, see http://localhost:6060/debug/pprof/") var genconf = flag.Bool("genconf", false, "print a new config to stdout") var useconf = flag.Bool("useconf", false, "read config from stdin") -var normaliseconf = flag.Bool("normaliseconf", false, "use in combination with -useconf, outputs your configuration normalised") +var useconffile = flag.String("useconffile", "", "read config from specified file path") +var normaliseconf = flag.Bool("normaliseconf", false, "use in combination with either -useconf or -useconffile, outputs your configuration normalised") var autoconf = flag.Bool("autoconf", false, "automatic mode (dynamic IP, peer with IPv6 neighbors)") func main() { @@ -132,10 +133,14 @@ func main() { switch { case *autoconf: cfg = generateConfig(true) - case *useconf: + case *useconffile != "" || *useconf: var config []byte var err error - config, err = ioutil.ReadAll(os.Stdin) + if *useconffile != "" { + config, err = ioutil.ReadFile(*useconffile) + } else { + config, err = ioutil.ReadAll(os.Stdin) + } if err != nil { panic(err) }