From 01c05e45267f0faeecc3f1d315d9b88b95437372 Mon Sep 17 00:00:00 2001 From: MS Date: Tue, 25 Oct 2022 15:45:47 +0200 Subject: fix -c option Python modules used to ignore it by completely reloading the config from a default location. CLI now passes values to them. --- talermerchantdemos/donations/donations.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'talermerchantdemos/donations') diff --git a/talermerchantdemos/donations/donations.py b/talermerchantdemos/donations/donations.py index 4ba5daa..9d6e453 100644 --- a/talermerchantdemos/donations/donations.py +++ b/talermerchantdemos/donations/donations.py @@ -20,6 +20,7 @@ import base64 import logging import flask +import uwsgi from flask import request, url_for from flask_babel import Babel from flask_babel import refresh @@ -44,6 +45,7 @@ if not sys.version_info.major == 3 and sys.version_info.minor >= 6: ) sys.exit(1) +logging.basicConfig() LOGGER = logging.getLogger(__name__) BASE_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -53,11 +55,10 @@ app.wsgi_app = ProxyFix(app.wsgi_app, x_host=1, x_prefix=1) app.debug = True app.secret_key = base64.b64encode(os.urandom(64)).decode("utf-8") -TC = TalerConfig.from_env() try: - BACKEND_BASE_URL = TC["frontends"]["backend"].value_string(required=True) - CURRENCY = TC["taler"]["currency"].value_string(required=True) - APIKEY = TC["frontends"]["backend_apikey"].value_string(required=True) + BACKEND_BASE_URL = uwsgi.opt["backend_url"].decode("utf-8") + CURRENCY = uwsgi.opt["currency"].decode("utf-8") + APIKEY = uwsgi.opt["apikey"].decode("utf-8") except ConfigurationError as ce: print(ce) exit(1) @@ -70,6 +71,8 @@ babel.localeselector(get_locale) LOGGER.info("Using translations from:" + ":".join(list(babel.translation_directories))) +LOGGER.info("backend: " + BACKEND_BASE_URL) +LOGGER.info("currency: " + CURRENCY) translations = [str(translation) for translation in babel.list_translations()] if not "en" in translations: translations.append("en") -- cgit v1.2.3