summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2016-10-14 04:06:14 -0300
committerVictor Shyba <victor1984@riseup.net>2016-10-21 14:09:54 -0300
commita3836cd316c31a7256b2e110776e93c21cc772cc (patch)
treee4b58957ca5ac6ffe1ba88eb5a31b20c6e9444a0
parente121a92161d3a18cebc8796d43b98c05b6916088 (diff)
[tests] fix server import
When importing server, couch_state will load itself against couch_db url configured on server. This fails when running on Docker as couchdb is in another node.
-rw-r--r--server/src/leap/soledad/server/__init__.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py
index e4fa4aa7..d154e3fe 100644
--- a/server/src/leap/soledad/server/__init__.py
+++ b/server/src/leap/soledad/server/__init__.py
@@ -272,12 +272,14 @@ def _get_couch_state():
SoledadBackend.BATCH_SUPPORT = conf.get('batching', False)
return state
+try:
+ _couch_state = _get_couch_state()
+ # a WSGI application that may be used by `twistd -web`
+ application = GzipMiddleware(
+ SoledadTokenAuthMiddleware(SoledadApp(_couch_state)))
+except:
+ pass
-_couch_state = _get_couch_state()
-
-# a WSGI application that may be used by `twistd -web`
-application = GzipMiddleware(
- SoledadTokenAuthMiddleware(SoledadApp(_couch_state)))
# another WSGI application in which we bypass token auth middleware for ease of
# mind while debugging in your local environment