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 <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-01-09 22:38:08 -08:00
parent e6679e4c4e
commit c775e8a692
No known key found for this signature in database
GPG key ID: F7E46DED420788F3

View file

@ -109,7 +109,8 @@ def make_context(request: Request, title: str, next: str = None):
"utcnow": int(datetime.utcnow().timestamp()), "utcnow": int(datetime.utcnow().timestamp()),
"config": aurweb.config, "config": aurweb.config,
"creds": aurweb.auth.creds, "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)
} }