summaryrefslogtreecommitdiff
path: root/bonafide
diff options
context:
space:
mode:
Diffstat (limited to 'bonafide')
-rw-r--r--bonafide/src/leap/bonafide/config.py9
-rw-r--r--bonafide/src/leap/bonafide/service.py11
2 files changed, 15 insertions, 5 deletions
diff --git a/bonafide/src/leap/bonafide/config.py b/bonafide/src/leap/bonafide/config.py
index 5aba663..496c9a8 100644
--- a/bonafide/src/leap/bonafide/config.py
+++ b/bonafide/src/leap/bonafide/config.py
@@ -47,6 +47,9 @@ def get_path_prefix(standalone=False):
return common_get_path_prefix(standalone)
+_preffix = get_path_prefix()
+
+
def get_provider_path(domain, config='provider.json'):
"""
Returns relative path for provider configs.
@@ -135,10 +138,12 @@ class Provider(object):
ongoing_bootstrap = defaultdict(None)
stuck_bootstrap = defaultdict(None)
- def __init__(self, domain, autoconf=True, basedir='~/.config/leap',
+ def __init__(self, domain, autoconf=True, basedir=None,
check_certificate=True):
- self._domain = domain
+ if not basedir:
+ basedir = os.path.join(_preffix, 'leap')
self._basedir = os.path.expanduser(basedir)
+ self._domain = domain
self._disco = Discovery('https://%s' % domain)
self._provider_config = None
diff --git a/bonafide/src/leap/bonafide/service.py b/bonafide/src/leap/bonafide/service.py
index 87c2ef5..6d3c61e 100644
--- a/bonafide/src/leap/bonafide/service.py
+++ b/bonafide/src/leap/bonafide/service.py
@@ -21,6 +21,7 @@ Bonafide Service.
import os
from collections import defaultdict
+from leap.common.config import get_path_prefix
from leap.common.service_hooks import HookableService
from leap.bonafide._protocol import BonafideProtocol
@@ -29,12 +30,16 @@ from twisted.internet import defer
from twisted.python import log
+_preffix = get_path_prefix()
+
+
class BonafideService(service.Service, HookableService):
- def __init__(self, basedir='~/.config/leap'):
- # TODO fix hardcoded basedir
- self._bonafide = BonafideProtocol()
+ def __init__(self, basedir=None):
+ if not basedir:
+ basedir = os.path.join(_preffix, 'leap')
self._basedir = os.path.expanduser(basedir)
+ self._bonafide = BonafideProtocol()
self.service_hooks = defaultdict(list)
# XXX this is a quick hack to get a ref