summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/taler-merchant-demos18
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/taler-merchant-demos b/bin/taler-merchant-demos
index 7ed69d7..0100748 100755
--- a/bin/taler-merchant-demos
+++ b/bin/taler-merchant-demos
@@ -90,22 +90,26 @@ def handle_serve_http(config, whichShop, port=None):
sys.stderr.write("Failed to start uwsgi. Please make sure to install uwsgi for Python3.")
sys.exit(1)
+def handle_serve_from_config(config_obj, which_shop):
+ if config_obj.get("serve", "") == "http":
+ http_port = config_obj.value_int(which_shop, "port")
+ return handle_serve_http(config_obj, which_shop, http_port)
+ handle_serve_uwsgi(config_obj, which_shop)
+
@click.command("Global shop launcher")
@click.option("--config", help="Configuration file", required=False)
-@click.option("--serve-http", help="Serve via HTTP", is_flag=True, required=False)
-@click.option("--port", help="HTTP port to serve (if not given, it's picked from config)", required=False, type=int)
-@click.option("--serve-uwsgi", help="Serve via UWSGI (default)", required=False)
+@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, serve_http, port, serve_uwsgi, which_shop):
+def demos(config, http_port, which_shop):
"""
WHICH_SHOP is one of: blog, donations, or survey.
"""
if config:
os.environ["TALER_CONFIG_FILE"] = config
config_obj = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE"))
- if serve_http: # port was given
- handle_serve_http(config_obj, which_shop, port)
+ if http_port:
+ handle_serve_http(config_obj, which_shop, http_port)
else:
+ handle_serve_from_config(config_obj, which_shop)
handle_serve_uwsgi(config_obj, which_shop)
-
demos()