Skip to content

Commit

Permalink
Add version+revision in the admin
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Apr 4, 2024
1 parent 2670eaf commit 2f7cb17
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion backend/seismic_site/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
HERE_MAPS_API_KEY=(str, ""),
DATA_UPLOAD_MAX_NUMBER_FIELDS=(int, 1000),
BACKGROUND_WORKERS_COUNT=(int, 1),
IS_CONTAINERIZED=(bool, True),
DJANGO_ADMIN_EMAIL=(str, ""),
DJANGO_ADMIN_PASSWORD=(str, ""),
# email settings
Expand Down Expand Up @@ -112,6 +113,23 @@
# Logging
DJANGO_LOG_LEVEL = env.str("LOG_LEVEL").upper()

# some settings will be different if it's not running in a container (e.g., locally, on a PC)
IS_CONTAINERIZED = BASE_DIR.startswith(os.path.join("/", "var", "www")) # noqa

VERSION = env.str("VERSION", "edge")
REVISION = env.str("REVISION", "develop")

if IS_CONTAINERIZED and VERSION == "edge" and REVISION == "develop":
version_file = os.path.join(BASE_DIR, ".version") # noqa
if os.path.exists(version_file):
with open(version_file) as f:
VERSION, REVISION = f.read().strip().split("+")

REVISION = REVISION[:7]

VERSION_SUFFIX = f"seismic@{VERSION}+{REVISION}"


LOGGING = {
"version": 1,
"disable_existing_loggers": False,
Expand Down Expand Up @@ -502,7 +520,7 @@
# Welcome text on the login screen
"welcome_sign": "",
# Copyright on the footer
"copyright": "Commit Global",
"copyright": f"Commit Global | {VERSION_SUFFIX}",
# The model admin to search from the search bar, search bar omitted if excluded
# "search_model": "donors.Donor",
# The field name on the user model that contains avatar image
Expand Down

0 comments on commit 2f7cb17

Please sign in to comment.