diff --git a/lenticular_cloud/app.py b/lenticular_cloud/app.py index 50f00fd..70e0f89 100644 --- a/lenticular_cloud/app.py +++ b/lenticular_cloud/app.py @@ -5,6 +5,7 @@ from jwkest.jwk import RSAKey, rsa_load from flask_babel import Babel from flask_login import LoginManager import time +import subprocess from pyop.authz_state import AuthorizationState from pyop.provider import Provider @@ -16,6 +17,12 @@ from . import model from .pki import Pki +def get_git_hash(): + try: + return subprocess.check_output(['git', 'rev-parse', 'HEAD'])[:10].decode() + except Exception: + return '' + def init_oidc_provider(app): with app.app_context(): issuer = url_for('frontend.index')[:-1] @@ -127,6 +134,8 @@ def oidc_provider_init_app(name=None): app.config.from_pyfile('application.cfg') app.config.from_pyfile('production.cfg') + app.jinja_env.globals['GIT_HASH'] = get_git_hash() + #app.ldap_orm = Connection(app.config['LDAP_URL'], app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PW'], auto_bind=True) server = Server(app.config['LDAP_URL'], get_info=ALL) app.ldap_conn = Connection(server, app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PW'], auto_bind=True) diff --git a/templates/skelet.html.j2 b/templates/skelet.html.j2 index c231879..cc120c9 100644 --- a/templates/skelet.html.j2 +++ b/templates/skelet.html.j2 @@ -4,12 +4,12 @@