show build on website footer
This commit is contained in:
@@ -29,6 +29,43 @@ BETA_USERS = {
|
||||
|
||||
# Logging für Auditing
|
||||
LOG_FILE = "access_log.json"
|
||||
BUILD_INFO_FILE = "build_info.json"
|
||||
UNKNOWN_BUILD_INFO = {
|
||||
"version": "unknown",
|
||||
"branch": "unknown",
|
||||
"commit": "unknown",
|
||||
"timestamp": "unknown"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# BUILD INFO
|
||||
# ============================================================================
|
||||
|
||||
def load_build_info():
|
||||
"""Load deployment/build metadata for templates."""
|
||||
try:
|
||||
with open(BUILD_INFO_FILE, "r") as f:
|
||||
data = json.load(f)
|
||||
except Exception as e:
|
||||
print(f"[Build Info Error] {e}")
|
||||
return UNKNOWN_BUILD_INFO.copy()
|
||||
|
||||
if not isinstance(data, dict):
|
||||
return UNKNOWN_BUILD_INFO.copy()
|
||||
|
||||
build_info = UNKNOWN_BUILD_INFO.copy()
|
||||
for key in build_info:
|
||||
value = data.get(key)
|
||||
if isinstance(value, str) and value.strip():
|
||||
build_info[key] = value.strip()
|
||||
return build_info
|
||||
|
||||
BUILD_INFO = load_build_info()
|
||||
|
||||
@app.context_processor
|
||||
def inject_build_info():
|
||||
"""Make build metadata available in all templates."""
|
||||
return {"build_info": BUILD_INFO}
|
||||
|
||||
# ============================================================================
|
||||
# AUTHENTICATION
|
||||
|
||||
Reference in New Issue
Block a user