Skip to content

Commit

Permalink
add last commit number to config
Browse files Browse the repository at this point in the history
  • Loading branch information
harminius committed Dec 8, 2023
1 parent 9201e0c commit 180a1e8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/mergin/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ def config():
cfg = {**cfg, **parsed_version}

cfg["server_configured"] = is_server_configured()
cfg["build_hash"] = application.config["BUILD_HASH"]
return jsonify(cfg), 200

# append project commands (from default sync module)
Expand Down
4 changes: 3 additions & 1 deletion server/mergin/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial

import os
from .version import get_version
from .version import get_version, get_git_hash
from decouple import config, Csv

config_dir = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -93,3 +93,5 @@ class Configuration(object):
SERVER_TYPE = config("SERVER_TYPE", default="")
# can users create their own account or is it reserved for superuser only
USER_SELF_REGISTRATION = config("USER_SELF_REGISTRATION", default=False, cast=bool)
# last commit hash number
BUILD_HASH = config("BUILD_NUMBER", default=get_git_hash())
1 change: 1 addition & 0 deletions server/mergin/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test_config(client):
"major",
"minor",
"user_self_registration",
"build_hash",
}
resp = client.get("/config")
assert resp.status_code == 200
Expand Down
4 changes: 4 additions & 0 deletions server/mergin/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@

def get_version():
return "2023.3.0"

def get_git_hash():
import subprocess
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()

0 comments on commit 180a1e8

Please sign in to comment.