diff options
Diffstat (limited to 'src/leap/bitmask/bonafide/config.py')
-rw-r--r-- | src/leap/bitmask/bonafide/config.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/leap/bitmask/bonafide/config.py b/src/leap/bitmask/bonafide/config.py index ba454651..1002edbd 100644 --- a/src/leap/bitmask/bonafide/config.py +++ b/src/leap/bitmask/bonafide/config.py @@ -234,10 +234,20 @@ class Provider(object): return False return True - def config(self): - if not self._provider_config: - self._load_provider_json() - return self._provider_config.dict() + def config(self, service=None): + if not service: + if not self._provider_config: + self._load_provider_json() + return self._provider_config.dict() + + path = self._get_service_config_path(service) + try: + with open(path, 'r') as config: + config = Record(**json.load(config)) + except IOError: + raise ValueError("Service " + service + + " not found in provider " + self._domain) + return config def bootstrap(self): domain = self._domain |