summaryrefslogtreecommitdiff
path: root/taler-merchant-survey.in
diff options
context:
space:
mode:
Diffstat (limited to 'taler-merchant-survey.in')
-rw-r--r--taler-merchant-survey.in47
1 files changed, 41 insertions, 6 deletions
diff --git a/taler-merchant-survey.in b/taler-merchant-survey.in
index ba82f03..e906f38 100644
--- a/taler-merchant-survey.in
+++ b/taler-merchant-survey.in
@@ -1,9 +1,25 @@
-#!/usr/bin/env python3
+##
+# This file is part of TALER
+# (C) 2017 INRIA
+#
+# TALER is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public
+# License as published by the Free Software Foundation; either
+# version 3, or (at your option) any later version.
+#
+# TALER is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with TALER; see the file COPYING. If not,
+# see <http://www.gnu.org/licenses/>
+#
+# @author Florian Dold
+# @file Standalone script to launch the Survey site.
-"""
-Stand-alone script to manage the GNU Taler
-survey frontend.
-"""
+#!/usr/bin/env python3
import argparse
import sys
@@ -19,11 +35,20 @@ site.addsitedir("%s/lib/python%d.%d/site-packages" % (
sys.version_info.major,
sys.version_info.minor))
+
+## @cond
TC = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE"))
LOGGER = logging.getLogger(__name__)
# No perfect match to our logging format, but good enough ...
UWSGI_LOGFMT = "%(ltime) %(proto) %(method) %(uri) %(proto) => %(status)"
+## @endcond
+
+##
+# This function interprets the 'serve-http' subcommand.
+# The effect it to launch the Survey site as a HTTP service.
+#
+# @param args command line options.
def handle_serve_http(args):
port = args.port
if port is None:
@@ -36,6 +61,14 @@ def handle_serve_http(args):
"--http", spec,
"--wsgi-file", "@prefix@/share/taler/frontend-survey.wsgi")
+
+##
+# This function interprets the 'serve-uwsgi' subcommand.
+# The effect is to launch the Survey UWSGI service. This
+# type of service is usually used when the HTTP Survey interface
+# is accessed via a reverse proxy (like Nginx, for example).
+#
+# @param command line options.
def handle_serve_uwsgi(args):
del args # pacify PEP checkers
serve_uwsgi = TC["survey"]["uwsgi_serve"].value_string(required=True).lower()
@@ -58,7 +91,7 @@ def handle_serve_uwsgi(args):
os.execlp(*params)
-
+## @cond
PARSER = argparse.ArgumentParser()
PARSER.set_defaults(func=None)
PARSER.add_argument('--config', '-c',
@@ -75,6 +108,8 @@ P = SUB.add_parser('serve-uwsgi', help="Serve over UWSGI")
P.set_defaults(func=handle_serve_uwsgi)
ARGS = PARSER.parse_args()
+## @endcond
+
if getattr(ARGS, 'func', None) is None:
PARSER.print_help()
sys.exit(1)