Skip to content

Commit

Permalink
✨ [#51] Showing version & git hash on the home page
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhanCitil committed Aug 4, 2023
1 parent 5af23cf commit db9a4c1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/openklant/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sentry_sdk

from .api import * # noqa
from .utils import config, get_current_version, get_sentry_integrations
from .utils import config, get_current_version, get_sentry_integrations, get_git_sha

# Build paths inside the project, so further paths can be defined relative to
# the code root.
Expand Down Expand Up @@ -434,6 +434,7 @@
#
SENTRY_DSN = config("SENTRY_DSN", None)
RELEASE = get_current_version()
GIT_SHA = get_git_sha()

# Two factor auth
# LOGIN_URL = "two_factor:login"
Expand Down
11 changes: 11 additions & 0 deletions src/openklant/conf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,14 @@ def get_current_version():
return _get_version_from_git()

return _get_version_from_file()

def get_git_sha():
"""
Returns the current git commit hash
"""
try:
return check_output(["git", "rev-parse", "HEAD"], universal_newlines=True)
except CalledProcessError:
logger.warning("Unable to list current commit hash")
return None

2 changes: 2 additions & 0 deletions src/openklant/utils/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def settings(request):
"SITE_TITLE",
"PROJECT_NAME",
"VNG_COMPONENTS_BRANCH",
"RELEASE",
"GIT_SHA",
)

context = {
Expand Down

0 comments on commit db9a4c1

Please sign in to comment.