- Improvements and bugfixes to HealthChecks

This commit is contained in:
Josako
2024-09-16 16:17:54 +02:00
parent 1622591afd
commit 67bdeac434
13 changed files with 53 additions and 47 deletions

View File

@@ -23,6 +23,14 @@ def cors_after_request(response, prefix):
current_app.logger.debug(f'request.args: {request.args}')
current_app.logger.debug(f'request is json?: {request.is_json}')
# Exclude health checks from checks
if request.path.startswith('/healthz') or request.path.startswith('/_healthz'):
current_app.logger.debug('Skipping CORS headers for health checks')
response.headers.add('Access-Control-Allow-Origin', '*')
response.headers.add('Access-Control-Allow-Headers', '*')
response.headers.add('Access-Control-Allow-Methods', '*')
return response
tenant_id = None
allowed_origins = []

View File

@@ -1,4 +1,4 @@
from flask import flash
from flask import flash, current_app
def prepare_table(model_objects, column_names):
@@ -44,7 +44,8 @@ def form_validation_failed(request, form):
for fieldName, errorMessages in form.errors.items():
for err in errorMessages:
flash(f"Error in {fieldName}: {err}", 'danger')
current_app.logger.debug(f"Error in {fieldName}: {err}", 'danger')
def form_to_dict(form):
return {field.name: field.data for field in form if field.name != 'csrf_token' and hasattr(field, 'data')}
return {field.name: field.data for field in form if field.name != 'csrf_token' and hasattr(field, 'data')}