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
2 changes: 2 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def create_app():
from app.api.admin_translations import admin_blueprint
from app.api.orders import alipay_blueprint
from app.api.settings import admin_misc_routes
from app.api.server_version import info_route

app.register_blueprint(api_v1)
app.register_blueprint(event_copy)
Expand All @@ -167,6 +168,7 @@ def create_app():
app.register_blueprint(admin_blueprint)
app.register_blueprint(alipay_blueprint)
app.register_blueprint(admin_misc_routes)
app.register_blueprint(info_route)

add_engine_pidguard(db.engine)

Expand Down
11 changes: 11 additions & 0 deletions app/api/server_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from flask import jsonify, Blueprint

SERVER_VERSION = '1.7.0-SNAPSHOT'

info_route = Blueprint('info', __name__, url_prefix='/v1')
_build = {'version': SERVER_VERSION}


@info_route.route('/info')
def version():
return jsonify(build=_build)