gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-bank] branch master updated: cli invocation


From: gnunet
Subject: [taler-bank] branch master updated: cli invocation
Date: Mon, 14 Sep 2020 14:20:40 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository bank.

The following commit(s) were added to refs/heads/master by this push:
     new 3dd9eb2  cli invocation
3dd9eb2 is described below

commit 3dd9eb2430167b004a422589c18afb692da0661c
Author: MS <ms@taler.net>
AuthorDate: Mon Sep 14 14:20:35 2020 +0200

    cli invocation
---
 bin/taler-bank-manage | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/bin/taler-bank-manage b/bin/taler-bank-manage
index 6e18cd1..81f3651 100755
--- a/bin/taler-bank-manage
+++ b/bin/taler-bank-manage
@@ -87,6 +87,13 @@ def handle_serve_http(args):
               "--module", "talerbank.wsgi"]
     os.execlp(*params)
 
+def handle_serve(args):
+    TC = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE", 
args.config))
+    serve = TC["bank"]["serve"].value_string(required=True).lower()
+    if serve == "http":
+        return handle_serve_http(args)
+    handle_serve_uwsgi(args)
+
 ##
 # This function interprets the 'serve-uwsgi' subcommand.
 # The effect is to launch the bank UWSGI service.  This
@@ -144,6 +151,9 @@ PARSER = argparse.ArgumentParser()
 PARSER.set_defaults(func=None)
 PARSER.add_argument('--config', '-c', help="configuration file to use",
                     metavar="CONFIG", type=str, dest="config", default=None)
+PARSER.add_argument('--http-port', '-p', help="serve via HTTP on PORT (has 
precedence over the configuration)",
+                    metavar="PORT", type=int, dest="port", default=None)
+
 PARSER.add_argument('--with-db', type=str, metavar="dbtype:///dbname", 
dest="altdb",
                     help="use 'dbname' (currently only 'dbtype'=='postgres' is 
supported)")
 SUB = PARSER.add_subparsers()
@@ -152,18 +162,12 @@ P = SUB.add_parser('django', help="Run django-admin 
command")
 P.add_argument("command", nargs=argparse.REMAINDER)
 P.set_defaults(func=handle_django)
 
-P = SUB.add_parser('serve-http', help="Serve bank over HTTP")
-P.add_argument("--port", "-p", dest="port", type=int,
-               default=None, metavar="PORT")
-P.set_defaults(func=handle_serve_http)
-
-P = SUB.add_parser('serve-uwsgi', help="Serve bank over UWSGI")
-P.set_defaults(func=handle_serve_uwsgi)
+P = SUB.add_parser('serve', help="Serve bank according to the configuration")
+P.set_defaults(func=handle_serve)
 
 P = SUB.add_parser('config', help="show config")
 P.set_defaults(func=handle_config)
 
-
 ARGS = PARSER.parse_args()
 
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "talerbank.settings")
@@ -172,13 +176,14 @@ if ARGS.altdb:
     LOGGER.info("Setting alternate db: %s" % ARGS.altdb)
     os.environ.setdefault("TALER_BANK_ALTDB", ARGS.altdb)
 
-if getattr(ARGS, 'func', None) is None:
-    PARSER.print_help()
-    sys.exit(1)
-
 if ARGS.config is not None:
     os.environ["TALER_CONFIG_FILE"] = ARGS.config
 
+if ARGS.port:
+    LOGGER.info("Serve via HTTP, on port: %s" % ARGS.port)
+    handle_serve_http(ARGS)
+    sys.exit(0)
+
 try:
     ARGS.func(ARGS)
 except django.db.utils.OperationalError as error:

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]