From 9dd136a44ea7ff52fdfb8c52ff5f1fadd8255cf1 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Mon, 3 Oct 2022 14:28:43 -0400 Subject: [PATCH] Show current (short) git hash on /status --- app/routes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/routes.py b/app/routes.py index ff9e551..cd0e604 100644 --- a/app/routes.py +++ b/app/routes.py @@ -1,6 +1,7 @@ # Copyright Sage Vaillancourt 2021 import json +import logging import os import subprocess import threading @@ -282,7 +283,9 @@ def git_update() -> None: @writing_blueprint.route('/status', methods=['GET']) def status_page() -> Response: status_message = f"Currently running on '{os.environ.get('UNDERCOVER_SERVER_NAME')}' server" - return make_response(render_template('error.jinja2', status=200, error_text=status_message), 200) + logging.error(subprocess.check_output(['pwd'])) + current_git_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'], shell=True, universal_newlines=True) + return make_response(render_template('error.jinja2', status=200, error_text=status_message, extra_text=current_git_hash), 200) @writing_blueprint.route('/', methods=['POST'])