summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-10-16 08:46:32 -0200
committerdrebs <drebs@riseup.net>2017-10-16 09:32:02 -0200
commit61f11a246a07435eadbf3ebf00ab336e45d68cd7 (patch)
treeb814324b6028d6015dc3421c06e39af7935d7356
parent1a8cc67319c9006fdcdafdb76e8583ef896cb0d2 (diff)
[bug] use all default server config values
Server config dictionary was being poorly updated, and not all default values were being added in runtime. This was mainly a problem in tests, but fixing may avoid possible bugs with this implementation in the future.
-rw-r--r--src/leap/soledad/server/auth.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/leap/soledad/server/auth.py b/src/leap/soledad/server/auth.py
index 39eb09f6..d0884e01 100644
--- a/src/leap/soledad/server/auth.py
+++ b/src/leap/soledad/server/auth.py
@@ -48,13 +48,17 @@ from ._config import get_config
log = Logger()
+def _update_with_defaults(conf):
+ for k, v in get_config().items():
+ conf.setdefault(k, v)
+
+
@implementer(IRealm)
class SoledadRealm(object):
- def __init__(self, sync_pool, conf=None):
+ def __init__(self, sync_pool, conf={}):
assert sync_pool is not None
- if conf is None:
- conf = get_config()
+ _update_with_defaults(conf)
blobs = conf['blobs']
concurrent_writes = conf['concurrent_blob_writes']
blobs_resource = BlobsResource(
@@ -110,9 +114,9 @@ class LocalServicesRealm(object):
class FileTokenChecker(object):
credentialInterfaces = [IUsernamePassword, IAnonymous]
- def __init__(self, conf=None):
+ def __init__(self, conf={}):
# conf parameter is only used during tests
- conf = conf or get_config()
+ _update_with_defaults(conf)
self._trusted_services_tokens = {}
self._tokens_file_path = conf['services_tokens_file']
self._reload_tokens()