diff options
Diffstat (limited to 'talermerchantdemos/cli.py')
-rw-r--r-- | talermerchantdemos/cli.py | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/talermerchantdemos/cli.py b/talermerchantdemos/cli.py index 78f9049..ee1be83 100644 --- a/talermerchantdemos/cli.py +++ b/talermerchantdemos/cli.py @@ -25,12 +25,14 @@ import argparse import sys import os import site -from taler.util.talerconfig import TalerConfig, ConfigurationError +from .util.talerconfig import TalerConfig, ConfigurationError LOGGER = logging.getLogger(__name__) # No perfect match to our logging format, but good enough ... UWSGI_LOGFMT = "%(ltime) %(proto) %(method) %(uri) %(proto) => %(status)" +arg_venvpath = ["-H", sys.prefix] + # Argument to tell uWSGI to load the python plugin. # This hack is required, because on systems where the plugin is statically linked, # loading it causes an error. @@ -48,6 +50,7 @@ def handle_serve_uwsgi(config, which_shop): params = [ "uwsgi", "uwsgi", + *arg_venvpath, *arg_load_python, "--master", "--die-on-term", @@ -56,6 +59,16 @@ def handle_serve_uwsgi(config, which_shop): "--module", "talermerchantdemos.{}:app".format(which_shop), "--need-app", + "--set-ph", "backend_url={}".format( + config["frontends"]["backend"].value_string(required=True) + ), + "--set-ph", "currency={}".format( + config["taler"]["currency"].value_string(required=True) + ), + "--set-ph", "apikey={}".format( + config["frontends"]["backend_apikey"].value_string(required=True) + ), + "--module", "--cache2", "name=paid_articles,items=500" ] @@ -88,11 +101,21 @@ def handle_serve_http(config, which_shop, port=None): params = [ "uwsgi", "uwsgi", + *arg_venvpath, *arg_load_python, "--master", "--die-on-term", "--log-format", UWSGI_LOGFMT, + "--set-ph", "backend_url={}".format( + config["frontends"]["backend"].value_string(required=True) + ), + "--set-ph", "currency={}".format( + config["taler"]["currency"].value_string(required=True) + ), + "--set-ph", "apikey={}".format( + config["frontends"]["backend_apikey"].value_string(required=True) + ), "--module", "talermerchantdemos.{}:app".format(which_shop), ] @@ -149,10 +172,10 @@ def handle_serve_from_config(config_obj, which_shop): ) @click.argument("which-shop") def demos(config, http_port, which_shop): - """WHICH_SHOP is one of: blog, donations, survey or landing.""" + """WHICH_SHOP is one of: blog, donations or landing.""" - if which_shop not in ["blog", "donations", "landing", "survey"]: - print("Please use a valid shop name: blog, donations, landing, survey.") + if which_shop not in ["blog", "donations", "landing"]: + print("Please use a valid shop name: blog, donations, landing.") sys.exit(1) config_obj = TalerConfig.from_file(config) if http_port: |