mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
version file has been updated to include a travis commit and time of build.
This commit is contained in:
@@ -121,13 +121,15 @@ def convert_to_number(value):
|
||||
|
||||
|
||||
def get_api_version():
|
||||
_version_re = re.compile(r'__version__\s+=\s+(.*)')
|
||||
version = 'n/a'
|
||||
dir_path = os.path.dirname(os.path.abspath(__file__))
|
||||
with open(os.path.join(dir_path, 'version.py'), 'rb') as f:
|
||||
version = str(ast.literal_eval(_version_re.search(
|
||||
f.read().decode('utf-8')).group(1)))
|
||||
return version
|
||||
build = 'n/a'
|
||||
build_time = "n/a"
|
||||
try:
|
||||
from app import version
|
||||
build = version.__build__
|
||||
build_time = version.__time__
|
||||
except:
|
||||
pass
|
||||
return build, build_time
|
||||
|
||||
|
||||
def get_db_version():
|
||||
|
||||
@@ -7,6 +7,8 @@ status = Blueprint('status', __name__)
|
||||
@status.route('/_status', methods=['GET', 'POST'])
|
||||
def show_status():
|
||||
from app import (get_api_version, get_db_version)
|
||||
build, build_time = get_api_version()
|
||||
return jsonify(status="ok",
|
||||
api_version=get_api_version(),
|
||||
api_build=build,
|
||||
api_built_time=build_time,
|
||||
db_version=get_db_version()), 200
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
__version__ = '0.1.1'
|
||||
__build__ = "12345"
|
||||
__time__ = "2016-01-01:10:10:10"
|
||||
|
||||
Reference in New Issue
Block a user