summaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorCarl Baldwin <carl@ecbaldwin.net>2019-08-16 09:17:43 -0600
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-08-28 09:06:20 +0900
commitfbe0ca9ede483494219b4365e142eabd41250713 (patch)
tree23bc8892a6fcaf5fb852a32fd210cc8a9e80b836 /cmd
parent8d9d5c91e99ef4a8582ff2d9bc16443dff9de78d (diff)
Document config API and provide examples
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gobgpd/main.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go
index 597a7df9..48eb43ac 100644
--- a/cmd/gobgpd/main.go
+++ b/cmd/gobgpd/main.go
@@ -181,7 +181,14 @@ func main() {
"Topic": "Config",
}).Info("Finished reading the config file")
- currentConfig := config.ApplyInitialConfig(context.Background(), bgpServer, initialConfig, opts.GracefulRestart)
+ currentConfig, err := config.InitialConfig(context.Background(), bgpServer, initialConfig, opts.GracefulRestart)
+ if err != nil {
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ "Error": err,
+ }).Fatalf("Failed to apply initial configuration %s", opts.ConfigFile)
+ }
+
for sig := range sigCh {
if sig != syscall.SIGHUP {
stopServer(bgpServer, opts.UseSdNotify)
@@ -200,7 +207,14 @@ func main() {
continue
}
- currentConfig = config.UpdateConfig(context.Background(), bgpServer, currentConfig, newConfig)
+ currentConfig, err = config.UpdateConfig(context.Background(), bgpServer, currentConfig, newConfig)
+ if err != nil {
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ "Error": err,
+ }).Warningf("Failed to update config %s", opts.ConfigFile)
+ continue
+ }
}
}