summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/bonafide/config.py
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-03-01 19:32:54 +0100
committerRuben Pollan <meskio@sindominio.net>2017-03-03 10:50:54 +0100
commit92957c4b666d6e5fc54275d8857692a12b0fb209 (patch)
tree2a0ae0439211b0c6476b5e5854af3db95aedfc4d /src/leap/bitmask/bonafide/config.py
parent1accda8a692798fccdd67584b1e4950057faddeb (diff)
[feat] get VPN params from eip-service.json
Instead of hardcoding them in the code.
Diffstat (limited to 'src/leap/bitmask/bonafide/config.py')
-rw-r--r--src/leap/bitmask/bonafide/config.py18
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