From fbe0ca9ede483494219b4365e142eabd41250713 Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Fri, 16 Aug 2019 09:17:43 -0600 Subject: Document config API and provide examples --- cmd/gobgpd/main.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'cmd') 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 + } } } -- cgit v1.2.3