From c775e8a69252245b4eaf8a26ac5213776354e9b1 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sun, 9 Jan 2022 22:38:08 -0800 Subject: [PATCH] feat(templates): add version to make_context Prioritizes COMMIT_HASH environment variable and uses `aurweb.config.AURWEB_VERSION` as a fallback. Signed-off-by: Kevin Morris --- aurweb/templates.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aurweb/templates.py b/aurweb/templates.py index 5eea1d3e..74c993f8 100644 --- a/aurweb/templates.py +++ b/aurweb/templates.py @@ -109,7 +109,8 @@ def make_context(request: Request, title: str, next: str = None): "utcnow": int(datetime.utcnow().timestamp()), "config": aurweb.config, "creds": aurweb.auth.creds, - "next": next if next else request.url.path + "next": next if next else request.url.path, + "version": os.environ.get("COMMIT_HASH", aurweb.config.AURWEB_VERSION) }