From 510a5d3a985b427012e1bee98355a0c9063dcc29 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Thu, 1 Aug 2024 14:12:16 +0200 Subject: [PATCH] Allow configuring qwc config schema in service config --- requirements.txt | 2 +- schemas/qwc-permalink-service.json | 4 ++++ src/server.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 23f4f47..451d1e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ Flask-JWT-Extended==4.6.0 flask-restx==1.3.0 psycopg2==2.9.9 SQLAlchemy==2.0.29 -qwc-services-core==1.3.29 +qwc-services-core==1.3.30 diff --git a/schemas/qwc-permalink-service.json b/schemas/qwc-permalink-service.json index 2d5c26d..98138d8 100644 --- a/schemas/qwc-permalink-service.json +++ b/schemas/qwc-permalink-service.json @@ -24,6 +24,10 @@ "description": "DB connection URL. Defaults to postgresql:///?service=qwc_configdb.", "type": "string" }, + "qwc_config_schema": { + "description": "The name of the DB schema which stores the qwc config. Default: qwc_config", + "type": "string" + }, "permalinks_table": { "description": "Permalink table. Defaults to qwc_config.permalinks.", "type": "string" diff --git a/src/server.py b/src/server.py index f5f3d53..122392d 100644 --- a/src/server.py +++ b/src/server.py @@ -16,8 +16,6 @@ from qwc_services_core.runtime_config import RuntimeConfig -qwc_config_schema = os.getenv("QWC_CONFIG_SCHEMA", "qwc_config") - # Flask application app = Flask(__name__) api = Api(app, version='1.0', title='Permalink API', @@ -53,6 +51,8 @@ def db_conn(): config = config_handler.tenant_config(tenant) db_url = config.get('db_url', 'postgresql:///?service=qwc_configdb') + qwc_config_schema = config.get('qwc_config_schema', 'qwc_config') + permalinks_table = config.get('permalinks_table', qwc_config_schema + '.permalinks') user_permalink_table = config.get( 'user_permalink_table', qwc_config_schema + '.user_permalinks')