summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/backend_app.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-01-08 14:34:13 -0400
committerKali Kaneko <kali@leap.se>2015-01-08 14:34:13 -0400
commitfdbfe431c52b2bc5a88a2328fe79de3035201099 (patch)
tree60d6af48f468f0dcd1922998e663f2273a55c41e /src/leap/bitmask/backend_app.py
parent77b576b58f7f533ff4f6a31594bb53d4ffad9d49 (diff)
parent54521d35d239c2e62d42e9c77690b9d1bc94f7db (diff)
Merge branch 'release/0.8.x' into debian/experimental
Diffstat (limited to 'src/leap/bitmask/backend_app.py')
-rw-r--r--src/leap/bitmask/backend_app.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/leap/bitmask/backend_app.py b/src/leap/bitmask/backend_app.py
index 716ae4a7..286b04f7 100644
--- a/src/leap/bitmask/backend_app.py
+++ b/src/leap/bitmask/backend_app.py
@@ -22,6 +22,8 @@ import multiprocessing
import signal
from leap.bitmask.backend.leapbackend import LeapBackend
+from leap.bitmask.backend.utils import generate_zmq_certificates
+from leap.bitmask.logs.utils import create_logger
from leap.bitmask.util import dict_to_flags
logger = logging.getLogger(__name__)
@@ -44,7 +46,7 @@ def signal_handler(signum, frame):
logger.debug("{0}: SIGNAL #{1} catched.".format(pname, signum))
-def run_backend(bypass_checks, flags_dict, frontend_pid=None):
+def run_backend(bypass_checks=False, flags_dict=None, frontend_pid=None):
"""
Run the backend for the application.
@@ -53,12 +55,22 @@ def run_backend(bypass_checks, flags_dict, frontend_pid=None):
:param flags_dict: a dict containing the flag values set on app start.
:type flags_dict: dict
"""
+ # The backend is the one who always creates the certificates. Either if it
+ # is run separately or in a process in the same app as the frontend.
+ generate_zmq_certificates()
+
# ignore SIGINT since app.py takes care of signaling SIGTERM to us.
signal.signal(signal.SIGINT, signal.SIG_IGN)
signal.signal(signal.SIGTERM, signal_handler)
- dict_to_flags(flags_dict)
+ if flags_dict is not None:
+ dict_to_flags(flags_dict)
backend = LeapBackend(bypass_checks=bypass_checks,
frontend_pid=frontend_pid)
backend.run()
+
+
+if __name__ == '__main__':
+ logger = create_logger(debug=True)
+ run_backend()