Skip to content

Commit

Permalink
Add git info to home page.
Browse files Browse the repository at this point in the history
  • Loading branch information
scossu committed Aug 14, 2024
1 parent e403023 commit 8bb201f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Core application dependencies.
aksharamukha>=2.2,<3
flask>=2.3,<3
flask-cors>=4.0,<5
python-dotenv>=1.0,<2
pyyaml>=6.0,<7
uwsgi>=2.0,<2.1
yiddish==0.0.21
5 changes: 5 additions & 0 deletions scriptshifter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"""
SMTP_HOST = environ.get("TXL_SMTP_HOST")

with open(path.join(path.dirname(APP_ROOT), "VERSION")) as fh:
version_info = fh.readlines()
GIT_TAG = version_info[0].strip()
GIT_COMMIT = version_info[1].strip()

logging.basicConfig(
# filename=environ.get("TXL_LOGFILE", "/dev/stdout"),
level=environ.get("TXL_LOGLEVEL", logging.WARN))
Expand Down
6 changes: 5 additions & 1 deletion scriptshifter/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
from flask import Flask, jsonify, render_template, request
from flask_cors import CORS

from scriptshifter import EMAIL_FROM, EMAIL_TO, SMTP_HOST, SMTP_PORT
from scriptshifter import (
EMAIL_FROM, EMAIL_TO,
GIT_COMMIT, GIT_TAG,
SMTP_HOST, SMTP_PORT)
from scriptshifter.exceptions import ApiError
from scriptshifter.tables import list_tables, load_table
from scriptshifter.trans import transliterate
Expand Down Expand Up @@ -69,6 +72,7 @@ def index():
return render_template(
"index.html",
languages=list_tables(),
version_info=(GIT_TAG, GIT_COMMIT),
feedback_form=SMTP_HOST is not None)


Expand Down
4 changes: 4 additions & 0 deletions scriptshifter/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ <h1 class="title is-1">{{ title }}</h1>
</div>
</section>
</main>
<footer>
<p>Scriptshifter version: tag {{ version_info[0] }} &mdash;&nbsp;
commit # {{ version_info[1] }}</p>
</footer>
</body>
</html>

0 comments on commit 8bb201f

Please sign in to comment.