diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-12-06 10:20:09 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-12-29 14:47:06 +0900 |
commit | d01c1586b9b1a25965448f9e15a05d94f2b22a5f (patch) | |
tree | 744609e474a9561dab792b60ab70d82696ab691e /gobgpd | |
parent | 58946b7924840f1effc993e95440266479c668d5 (diff) |
config: use viper and support multiple configuration formats
// toml by default
$ gobgpd -f gobgpd.toml
// use -t to change configuration type
$ gobgpd -t yaml -f gobgpd.yaml
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'gobgpd')
-rw-r--r-- | gobgpd/main.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go index 32743497..204a068b 100644 --- a/gobgpd/main.go +++ b/gobgpd/main.go @@ -39,6 +39,7 @@ func main() { var opts struct { ConfigFile string `short:"f" long:"config-file" description:"specifying a config file"` + ConfigType string `short:"t" long:"config-type" description:"specifying config type (toml, yaml, json)" default:"toml"` LogLevel string `short:"l" long:"log-level" description:"specifying log level"` LogPlain bool `short:"p" long:"log-plain" description:"use plain format for logging (json by default)"` UseSyslog string `short:"s" long:"syslog" description:"use syslogd"` @@ -161,7 +162,7 @@ func main() { } go m.Serve() } else if opts.ConfigFile != "" { - go config.ReadConfigfileServe(opts.ConfigFile, configCh, reloadCh) + go config.ReadConfigfileServe(opts.ConfigFile, opts.ConfigType, configCh, reloadCh) reloadCh <- true } go bgpServer.Serve() |