summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/core/flags.py1
-rw-r--r--src/leap/bitmask/core/launcher.py7
-rw-r--r--src/leap/bitmask/core/service.py13
3 files changed, 15 insertions, 6 deletions
diff --git a/src/leap/bitmask/core/flags.py b/src/leap/bitmask/core/flags.py
new file mode 100644
index 00000000..9a40c70c
--- /dev/null
+++ b/src/leap/bitmask/core/flags.py
@@ -0,0 +1 @@
+BACKEND = 'default'
diff --git a/src/leap/bitmask/core/launcher.py b/src/leap/bitmask/core/launcher.py
index b2319077..b8916a1e 100644
--- a/src/leap/bitmask/core/launcher.py
+++ b/src/leap/bitmask/core/launcher.py
@@ -17,17 +17,22 @@
"""
Run bitmask daemon.
"""
-from twisted.scripts.twistd import run
from os.path import join
from sys import argv
+from twisted.scripts.twistd import run
+
from leap.bitmask.util import here
from leap.bitmask import core
+from leap.bitmask.core import flags
def run_bitmaskd():
# TODO --- configure where to put the logs... (get --logfile, --logdir
# from the bitmask_cli
+ for (index, arg) in enumerate(argv):
+ if arg == '--backend':
+ flags.BACKEND = argv[index + 1]
argv[1:] = [
'-y', join(here(core), "bitmaskd.tac"),
'--pidfile', '/tmp/bitmaskd.pid',
diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py
index ddd86155..fca51048 100644
--- a/src/leap/bitmask/core/service.py
+++ b/src/leap/bitmask/core/service.py
@@ -17,6 +17,7 @@
"""
Bitmask-core Service.
"""
+import json
import resource
from twisted.internet import reactor
@@ -26,6 +27,7 @@ from leap.bitmask import __version__
from leap.bitmask.core import configurable
from leap.bitmask.core import mail_services
from leap.bitmask.core import _zmq
+from leap.bitmask.core import flags
from leap.bonafide.service import BonafideService
from leap.common.events import server as event_server
# from leap.vpn import EIPService
@@ -126,17 +128,18 @@ class BitmaskBackend(configurable.ConfigurableService):
# we may want to make this tuple a class member
services = ('soledad', 'keymanager', 'mail', 'eip')
- status_messages = []
+ status = {}
for name in services:
- status = 'stopped'
+ _status = 'stopped'
try:
if self.getServiceNamed(name).running:
- status = "running"
+ _status = 'running'
except KeyError:
pass
- status_messages.append("[{}: {}]".format(name, status))
+ status[name] = _status
+ status['backend'] = flags.BACKEND
- return " ".join(status_messages)
+ return json.dumps(status)
def do_version(self):
version = __version__