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

feat: Add endpoint for server version #6524

Merged
merged 12 commits into from
Oct 19, 2019
3 changes: 3 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from app.views.redis_store import redis_store
from app.views.celery_ import celery
from app.templates.flask_ext.jinja.filters import init_filters
from app.api.server_version import ServerVersion

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'app.api.server_version.ServerVersion' imported but unused

iamareebjamal marked this conversation as resolved.
Show resolved Hide resolved


BASE_DIR = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -133,6 +134,7 @@ def create_app():

# development api
with app.app_context():
from app.api.server_version import server_version_route
from app.api.admin_statistics_api.events import event_statistics
from app.api.auth import auth_routes
from app.api.attendees import attendee_misc_routes
Expand All @@ -157,6 +159,7 @@ def create_app():
app.register_blueprint(import_routes)
app.register_blueprint(celery_routes)
app.register_blueprint(auth_routes)
app.register_blueprint(server_version_route)
app.register_blueprint(event_statistics)
app.register_blueprint(user_misc_routes)
app.register_blueprint(attendee_misc_routes)
Expand Down
13 changes: 13 additions & 0 deletions app/api/server_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from flask import jsonify, Blueprint


SERVER_VERSION = '1.0'

server_version_route = Blueprint('server_version', __name__, url_prefix='/v1')


class ServerVersion:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

@staticmethod
@server_version_route.route('/server_version')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it /info

This JSON should be the output

{
  "build": {
    "version": "2.2.3-SNAPSHOT",
    "time": "2019-10-15T07:26:58.080Z"
  }
}

def version():
return jsonify(server_version=SERVER_VERSION)