Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API route endpoint for checking current deployed version #170

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/app/getGitHash.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from subprocess import check_output

def getGitHash():
return check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
9 changes: 8 additions & 1 deletion backend/app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from app.get_travel_time import get_travel_time
from app.get_here_links import get_here_links
from app.get_centreline_links import get_centreline_links

from app.getGitHash import getGitHash
@app.route('/')
def index():
"""Provide basic documentation about the available resources.
Expand All @@ -25,6 +25,13 @@ def index():
]
})

@app.route('/version')
def version():
"""Return the Git hash of the current application HEAD"""
return jsonify({
'git-HEAD': getGitHash()
})

# test URL /closest-node/-79.3400/43.6610
@app.route('/nodes-within/<meters>/<longitude>/<latitude>', methods=['GET'])
def closest_node(meters, longitude, latitude):
Expand Down
Loading