5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-26 01:21:37 +00:00

revert removal of useconffile

This commit is contained in:
Arceliar 2018-05-27 12:31:35 -05:00
parent fcaabe4aac
commit e62cfa8c84

View File

@ -123,7 +123,8 @@ func doGenconf() string {
var pprof = flag.Bool("pprof", false, "Run pprof, see http://localhost:6060/debug/pprof/") 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 genconf = flag.Bool("genconf", false, "print a new config to stdout")
var useconf = flag.Bool("useconf", false, "read config from stdin") 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)") var autoconf = flag.Bool("autoconf", false, "automatic mode (dynamic IP, peer with IPv6 neighbors)")
func main() { func main() {
@ -132,10 +133,14 @@ func main() {
switch { switch {
case *autoconf: case *autoconf:
cfg = generateConfig(true) cfg = generateConfig(true)
case *useconf: case *useconffile != "" || *useconf:
var config []byte var config []byte
var err error 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 { if err != nil {
panic(err) panic(err)
} }