From 7af81375a4d2765d0dcc97b1a069ceffe694a258 Mon Sep 17 00:00:00 2001
From: gjahn <gregor.jahn@bht-berlin.de>
Date: Sat, 25 Nov 2023 00:35:39 +0100
Subject: [PATCH] Allow to set version via environment variable

The version is displayed on the HTML-based landing page.
---
 configuration/config.go | 2 ++
 routing/routes.go       | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/configuration/config.go b/configuration/config.go
index 4943459..2f28320 100644
--- a/configuration/config.go
+++ b/configuration/config.go
@@ -12,6 +12,8 @@ const BODY_SIZE_LIMIT = 32 * 1024 * 1024    // 32 MB, in bytes
 
 
 type Config struct {
+    Version     string `env:"VERSION"   envDefault:"N/A"`
+
     Environment string `env:"ENV_NAME" envDefault:"development"`
     Host        string `env:"HOST" envDefault:"127.0.0.1"`
     Port        int16  `env:"PORT" envDefault:"3000"`
diff --git a/routing/routes.go b/routing/routes.go
index 048249a..30b607f 100644
--- a/routing/routes.go
+++ b/routing/routes.go
@@ -34,7 +34,7 @@ func SetRoutes( router *f.App, config *configuration.Config, store state.Store,
         }
 
         data := indexHtmlData{
-            Version: "",
+            Version: config.Version,
             Color: "",
         }
 
-- 
GitLab