File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -41,17 +41,24 @@ def create_application():
41
41
@APP .route (f'{ ROUTE_PREFIX } /' , methods = ['GET' ], strict_slashes = False )
42
42
def get_root ():
43
43
"""Root Endpoint for 3scale."""
44
- if collector .utils .ping_redis ():
45
- return jsonify (
46
- status = 'OK' ,
47
- version = API_VERSION ,
48
- message = 'Up and Running'
49
- )
44
+ if not collector .WORKER :
45
+ return_code = 500
46
+ status = 'Error'
47
+ message = 'No worker set'
48
+ elif not collector .utils .ping_redis ():
49
+ return_code = 500
50
+ status = 'Error'
51
+ message = 'Required service not operational'
52
+ else :
53
+ return_code = 200
54
+ status = 'OK'
55
+ message = 'Up and Running'
56
+
50
57
return jsonify (
51
- status = 'Error' ,
58
+ status = status ,
52
59
version = API_VERSION ,
53
- message = "Required service not operational"
54
- ), 500
60
+ message = message
61
+ ), return_code
55
62
56
63
57
64
@APP .route (f'{ ROUTE_PREFIX } /v{ API_VERSION } /version' , methods = ['GET' ])
You can’t perform that action at this time.
0 commit comments