"Update backend configuration and tests for improved stability"

This commit is contained in:
2025-05-23 08:54:23 +02:00
parent c1e8ee01c5
commit a11721f677
5 changed files with 412 additions and 47 deletions

View File

@@ -90,6 +90,18 @@ def create_app(config_name=None):
# Hintergrund-Tasks registrieren
register_background_tasks(app)
# Parse PRINTERS als JSON
printers_env = app.config.get('PRINTERS', '{}')
if isinstance(printers_env, str):
try:
app.config['PRINTERS'] = json.loads(printers_env)
except (json.JSONDecodeError, TypeError):
app.config['PRINTERS'] = {}
elif isinstance(printers_env, dict):
app.config['PRINTERS'] = printers_env
else:
app.config['PRINTERS'] = {}
return app
# Initialisierung - wird später durch create_app ersetzt
@@ -1943,4 +1955,16 @@ else:
printers_config = json.loads(app.config.get('PRINTERS', '{}'))
if printers_config:
init_printers()
setup_frontend_v2()
setup_frontend_v2()
# Parse PRINTERS als JSON
printers_env = app.config.get('PRINTERS', '{}')
if isinstance(printers_env, str):
try:
app.config['PRINTERS'] = json.loads(printers_env)
except (json.JSONDecodeError, TypeError):
app.config['PRINTERS'] = {}
elif isinstance(printers_env, dict):
app.config['PRINTERS'] = printers_env
else:
app.config['PRINTERS'] = {}