gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-backoffice] branch master updated: gitignore + addin


From: gnunet
Subject: [GNUnet-SVN] [taler-backoffice] branch master updated: gitignore + adding --frontend argument
Date: Fri, 05 Jan 2018 12:07:00 +0100

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

marcello pushed a commit to branch master
in repository backoffice.

The following commit(s) were added to refs/heads/master by this push:
     new 8291b60  gitignore + adding --frontend argument
8291b60 is described below

commit 8291b60dcde71177436189494b0576612bef1340
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Jan 5 12:06:34 2018 +0100

    gitignore + adding --frontend argument
---
 .gitignore                                         | 12 +++
 taler-merchant-backoffice-donations.in             | 86 ----------------------
 ...koffice-blog.in => taler-merchant-backoffice.in | 17 +++--
 3 files changed, 22 insertions(+), 93 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3a24ccc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+Makefile
+aclocal.m4
+autom4te.cache/
+compile
+config.log
+config.status
+configure
+install-sh
+missing
+talerbackoffice.egg-info/
+talerbackoffice/__pycache__/
+talerbackoffice/backoffice/__pycache__/
diff --git a/taler-merchant-backoffice-donations.in 
b/taler-merchant-backoffice-donations.in
deleted file mode 100644
index ca1b7c7..0000000
--- a/taler-merchant-backoffice-donations.in
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env python3
-
-"""
-Stand-alone script to manage the GNU Taler blog frontend.
-"""
-
-import logging
-import argparse
-import sys
-import os
-import site
-from talerblog.talerconfig import TalerConfig
-
-
-os.environ.setdefault("TALER_PREFIX", "@prefix@")
-site.addsitedir("%s/lib/python%d.%d/site-packages" % (
-    "@prefix@",
-    sys.version_info.major,
-    sys.version_info.minor))
-
-LOGGER = logging.getLogger(__name__)
-TC = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE"))
-
-# No perfect match to our logging format, but good enough ...
-UWSGI_LOGFMT = "%(ltime) %(proto) %(method) %(uri) %(proto) => %(status)"
-
-def handle_serve_http(args):
-    port = args.port
-    if port is None:
-        port = TC["blog"]["http_port"].value_int(required=True)
-    spec = ":%d" % (port,)
-    os.execlp("uwsgi", "uwsgi",
-              "--master",
-              "--die-on-term",
-              "--log-format", UWSGI_LOGFMT,
-              "--http", spec,
-              "--wsgi-file", "@prefix@/share/taler/frontend-blog.wsgi")
-
-def handle_serve_uwsgi(args):
-    del args # pacify PEP checkers
-    serve_uwsgi = TC["blog"]["uwsgi_serve"].value_string(required=True).lower()
-    params = ["uwsgi", "uwsgi",
-              "--master",
-              "--die-on-term",
-              "--log-format", UWSGI_LOGFMT,
-              "--wsgi-file", "@prefix@/share/taler/frontend-blog.wsgi"]
-    if serve_uwsgi == "tcp":
-        port = TC["blog"]["uwsgi_port"].value_int(required=True)
-        spec = ":%d" % (port,)
-        params.extend(["--socket", spec])
-    elif serve_uwsgi == "unix":
-        spec = TC["blog"]["uwsgi_unixpath"].value_filename(required=True)
-        mode = TC["blog"]["uwsgi_unixpath_mode"].value_filename(required=True)
-        params.extend(["--socket", spec])
-        params.extend(["--chmod-socket="+mode])
-        os.makedirs(os.path.dirname(spec), exist_ok=True)
-    logging.info("launching uwsgi with argv %s", params[1:])
-    os.execlp(*params)
-
-
-
-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)
-SUB = PARSER.add_subparsers()
-
-P = SUB.add_parser('serve-http', help="Serve 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 over UWSGI")
-P.set_defaults(func=handle_serve_uwsgi)
-
-ARGS = PARSER.parse_args()
-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
-
-ARGS.func(ARGS)
diff --git a/taler-merchant-backoffice-blog.in b/taler-merchant-backoffice.in
similarity index 75%
rename from taler-merchant-backoffice-blog.in
rename to taler-merchant-backoffice.in
index ca1b7c7..976c5f2 100644
--- a/taler-merchant-backoffice-blog.in
+++ b/taler-merchant-backoffice.in
@@ -9,7 +9,7 @@ import argparse
 import sys
 import os
 import site
-from talerblog.talerconfig import TalerConfig
+from talerbackoffice.talerconfig import TalerConfig
 
 
 os.environ.setdefault("TALER_PREFIX", "@prefix@")
@@ -27,7 +27,7 @@ UWSGI_LOGFMT = "%(ltime) %(proto) %(method) %(uri) %(proto) 
=> %(status)"
 def handle_serve_http(args):
     port = args.port
     if port is None:
-        port = TC["blog"]["http_port"].value_int(required=True)
+        port = TC["backoffice-%s" % 
args.frontend]["http_port"].value_int(required=True)
     spec = ":%d" % (port,)
     os.execlp("uwsgi", "uwsgi",
               "--master",
@@ -38,19 +38,19 @@ def handle_serve_http(args):
 
 def handle_serve_uwsgi(args):
     del args # pacify PEP checkers
-    serve_uwsgi = TC["blog"]["uwsgi_serve"].value_string(required=True).lower()
+    serve_uwsgi = TC["backoffice-%s" % 
args.frontend]["uwsgi_serve"].value_string(required=True).lower()
     params = ["uwsgi", "uwsgi",
               "--master",
               "--die-on-term",
               "--log-format", UWSGI_LOGFMT,
               "--wsgi-file", "@prefix@/share/taler/frontend-blog.wsgi"]
     if serve_uwsgi == "tcp":
-        port = TC["blog"]["uwsgi_port"].value_int(required=True)
+        port = TC["backoffice-%s" 
args.frontend]["uwsgi_port"].value_int(required=True)
         spec = ":%d" % (port,)
         params.extend(["--socket", spec])
     elif serve_uwsgi == "unix":
-        spec = TC["blog"]["uwsgi_unixpath"].value_filename(required=True)
-        mode = TC["blog"]["uwsgi_unixpath_mode"].value_filename(required=True)
+        spec = TC["backoffice-%s" % 
args.frontend]["uwsgi_unixpath"].value_filename(required=True)
+        mode = TC["backoffice-%s" % 
args.frontend]["uwsgi_unixpath_mode"].value_filename(required=True)
         params.extend(["--socket", spec])
         params.extend(["--chmod-socket="+mode])
         os.makedirs(os.path.dirname(spec), exist_ok=True)
@@ -58,13 +58,16 @@ def handle_serve_uwsgi(args):
     os.execlp(*params)
 
 
-
 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('--frontend', '-f',
+                    help="fetch config values from [backoffice-<FRONTEND>] 
section",
+                    metavar="FRONTEND", type=str,
+                    dest="frontend", default=None)
 SUB = PARSER.add_subparsers()
 
 P = SUB.add_parser('serve-http', help="Serve over HTTP")

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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