fix healthcheck
This commit is contained in:
22
app.py
22
app.py
@@ -4105,17 +4105,23 @@ def admin_lists_access(list_id=None):
|
||||
)
|
||||
|
||||
|
||||
@app.route("/healthcheck")
|
||||
@app.route('/healthcheck')
|
||||
def healthcheck():
|
||||
header_token = request.headers.get("X-Internal-Check")
|
||||
correct_token = app.config.get("HEALTHCHECK_TOKEN")
|
||||
|
||||
header_token = request.headers.get('X-Internal-Check')
|
||||
correct_token = app.config.get('HEALTHCHECK_TOKEN')
|
||||
if header_token != correct_token:
|
||||
abort(404)
|
||||
|
||||
response_data = {
|
||||
"status": "OK",
|
||||
}
|
||||
|
||||
try:
|
||||
db.session.execute(text('SELECT 1'))
|
||||
db.session.commit()
|
||||
response_data = {"status": "ok"}
|
||||
except Exception as e:
|
||||
response_data = {
|
||||
"status": "waiting",
|
||||
"message": "waiting for db",
|
||||
"error": str(e)
|
||||
}
|
||||
|
||||
return response_data, 200
|
||||
|
||||
|
||||
Reference in New Issue
Block a user