From 6b2d980df841068bca3fe88f2e39091858491edf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 Apr 2024 17:25:56 +0200 Subject: disable fiber startup message in production --- internal/config/config.go | 4 +++- server.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 96f721e..ebd3cfb 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -36,6 +36,7 @@ type Config struct { BaseURL URL `toml:"base_url"` RedirectOtherHostnames bool `toml:"redirect_other_hostnames"` Port uint64 + Production bool Title string Email string Description string @@ -85,7 +86,8 @@ func GetConfig() (*Config, error) { return nil, err } config.Port = port - if os.Getenv("ENV") != "production" { + config.Production = os.Getenv("ENV") == "production" + if !config.Production { err = setDevelopmentOverrides(&config) if err != nil { return nil, errors.WithMessage(err, "could not override configuration") diff --git a/server.go b/server.go index dc8ea7b..793345d 100644 --- a/server.go +++ b/server.go @@ -117,7 +117,9 @@ func main() { website.Use(notFoundHandler) hosts[config.BaseURL.Host] = &Host{website} - toplevel := fiber.New() + toplevel := fiber.New(fiber.Config{ + DisableStartupMessage: config.Production, + }) toplevel.Get("/health", func(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusOK) }) -- cgit 1.4.1