"Refactor backend configuration and setup for improved maintainability (feat)"

This commit is contained in:
2025-05-23 08:56:29 +02:00
parent a11721f677
commit 9614267d48
4 changed files with 62 additions and 64 deletions

View File

@@ -1952,19 +1952,7 @@ else:
with app.app_context():
init_db()
printers_config = json.loads(app.config.get('PRINTERS', '{}'))
printers_config = app.config.get('PRINTERS', {})
if printers_config:
init_printers()
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'] = {}
setup_frontend_v2()