Skip to content

Commit 75229f0

Browse files
djb4aiiamareebjamal
authored andcommitted
feat: Add endpoint for server version (#6524)
* Add rest endpoint for server version * Fix error message * Fix the hound issues * Change route to '/info' and modify json to include timestamp * Remove the class and define the method only for /info route * move import and register blueprint to end * register blueprint to end for info route * put register blueprint for info_route back * Move the register blueprints to original place * Update __init__.py
1 parent c873481 commit 75229f0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

app/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def create_app():
150150
from app.api.admin_translations import admin_blueprint
151151
from app.api.orders import alipay_blueprint
152152
from app.api.settings import admin_misc_routes
153+
from app.api.server_version import info_route
153154

154155
app.register_blueprint(api_v1)
155156
app.register_blueprint(event_copy)
@@ -168,6 +169,7 @@ def create_app():
168169
app.register_blueprint(admin_blueprint)
169170
app.register_blueprint(alipay_blueprint)
170171
app.register_blueprint(admin_misc_routes)
172+
app.register_blueprint(info_route)
171173

172174
add_engine_pidguard(db.engine)
173175

app/api/server_version.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from flask import jsonify, Blueprint
2+
3+
SERVER_VERSION = '1.7.0-SNAPSHOT'
4+
5+
info_route = Blueprint('info', __name__, url_prefix='/v1')
6+
_build = {'version': SERVER_VERSION}
7+
8+
9+
@info_route.route('/info')
10+
def version():
11+
return jsonify(build=_build)

0 commit comments

Comments
 (0)