diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/mobius-hotline-server/main.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/mobius-hotline-server/main.go b/cmd/mobius-hotline-server/main.go index 1c298a2..117cb2a 100644 --- a/cmd/mobius-hotline-server/main.go +++ b/cmd/mobius-hotline-server/main.go @@ -159,11 +159,12 @@ func main() { } bannerPath := path.Join(*configDir, config.BannerFile) - srv.Banner, err = os.ReadFile(bannerPath) + banner, err := os.ReadFile(bannerPath) if err != nil { slogger.Error("Error loading banner", "err", err) os.Exit(1) } + srv.SetBanner(banner) reloadFunc := func() { if err := srv.MessageBoard.(*mobius.FlatNews).Reload(); err != nil { @@ -185,11 +186,13 @@ func main() { slogger.Error("Error reloading agreement", "err", err) } - // Let's try to reload the banner + // Let's try to reload the banner. On failure, keep serving the previous banner. bannerPath := path.Join(*configDir, config.BannerFile) - srv.Banner, err = os.ReadFile(bannerPath) + banner, err := os.ReadFile(bannerPath) if err != nil { slogger.Error("Error reloading banner", "err", err) + } else { + srv.SetBanner(banner) } } |