From 16de66ffb8469d59f48f06c611b2ea62832b7bdf Mon Sep 17 00:00:00 2001 From: MS Date: Mon, 12 Oct 2020 13:00:52 +0200 Subject: ensure valid shop name --- bin/taler-merchant-demos | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'bin/taler-merchant-demos') diff --git a/bin/taler-merchant-demos b/bin/taler-merchant-demos index ade40cf..e7c3821 100755 --- a/bin/taler-merchant-demos +++ b/bin/taler-merchant-demos @@ -92,8 +92,7 @@ def handle_serve_http(config, which_shop, port=None): def handle_serve_from_config(config_obj, which_shop): try: if config_obj.value_string(which_shop, "serve", required=True).lower() == "http": - http_port = config_obj.value_int(which_shop, "port") - return handle_serve_http(config_obj, which_shop, http_port) + return handle_serve_http(config_obj, which_shop) handle_serve_uwsgi(config_obj, which_shop) except ConfigurationError as ce: print(ce) @@ -104,12 +103,12 @@ def handle_serve_from_config(config_obj, which_shop): @click.option("--http-port", help="HTTP port to serve (if not given, serving comes from config)", required=False, type=int) @click.argument("which-shop") def demos(config, http_port, which_shop): - """ - WHICH_SHOP is one of: blog, donations, survey or landing. - """ - if config: - os.environ["TALER_CONFIG_FILE"] = config - config_obj = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE")) + """WHICH_SHOP is one of: blog, donations, survey or landing.""" + + if which_shop not in ["blog", "donations", "survey"]: + print("Please use a valid shop name: blog, donations, survey.") + sys.exit(1) + config_obj = TalerConfig.from_file(config) if http_port: return handle_serve_http(config_obj, which_shop, http_port) handle_serve_from_config(config_obj, which_shop) -- cgit v1.2.3