(version) convey version information to the /config endpoint and footer

We add the machinery to get version information and display it discreetly.
This commit is contained in:
Laurent Bossavit
2024-11-15 15:54:30 +01:00
committed by Laurent Bossavit
parent bbe8f32b96
commit 43c18cb4e6
9 changed files with 42 additions and 1 deletions

View File

@@ -44,6 +44,17 @@ def get_release():
return "NA" # Default: not available
def get_commit():
"""
Get the current commit of the application
"""
try:
with open(os.path.join(BASE_DIR, "version.json"), encoding="utf8") as version:
return json.load(version)["commit"]
except FileNotFoundError:
return "NA" # Default: not available
class Base(Configuration):
"""
This is the base configuration every configuration (aka environment) should inherit from. It
@@ -488,6 +499,14 @@ class Base(Configuration):
"""
return get_release()
# pylint: disable=invalid-name
@property
def COMMIT(self):
"""
Return the commit information.
"""
return get_commit()
# pylint: disable=invalid-name
@property
def PARLER_LANGUAGES(self):