summaryrefslogtreecommitdiff
path: root/bonafide
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-03-04 01:42:45 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-03-04 01:42:45 -0400
commited3a66e70899231ae90ba323ee82f52af027c26c (patch)
tree4887673c517567fc3983358c0b013f30c875db67 /bonafide
parent38a5c3c73832110922b3628e791070d2034c625c (diff)
fix hardcoded basedir path
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 5aba6631..496c9a83 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 87c2ef5b..6d3c61ee 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