From a3836cd316c31a7256b2e110776e93c21cc772cc Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 14 Oct 2016 04:06:14 -0300 Subject: [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. --- server/src/leap/soledad/server/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'server/src/leap') 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 -- cgit v1.2.3