summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2016-04-07 16:00:04 -0400
committerKali Kaneko <kali@leap.se>2016-06-06 19:58:50 -0400
commit1fd07f013736599159c364b774ca5b3c6c6747c0 (patch)
tree9b7bda28ee932f093c24951c91f90df84ac118cd
parent66e3572959774449d4efca5b72efe41af54075e7 (diff)
[feature] debug-mode server with dummy authentication
to ease debugging of local servers w/o neededing the Token machinery in place. this needs still some extra changes to be fully functional: - adapt the create-userdb script to work with no auth info.
-rw-r--r--server/src/leap/soledad/server/__init__.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py
index 72d61224..195714c1 100644
--- a/server/src/leap/soledad/server/__init__.py
+++ b/server/src/leap/soledad/server/__init__.py
@@ -304,16 +304,34 @@ def load_configuration(file_path):
# Run as Twisted WSGI Resource
# ----------------------------------------------------------------------------
-def application(environ, start_response):
+
+def _load_config():
conf = load_configuration('/etc/soledad/soledad-server.conf')
- conf = conf['soledad-server']
+ return conf['soledad-server']
+
+
+def _get_couch_state():
+ conf = _load_config()
state = CouchServerState(conf['couch_url'], create_cmd=conf['create_cmd'])
- SoledadBackend.BATCH_SUPPORT = conf['batching']
- # WSGI application that may be used by `twistd -web`
+ SoledadBackend.BATCH_SUPPORT = conf.get('batching', False)
+ return state
+
+
+def application(environ, start_response):
+ """return WSGI application that may be used by `twistd -web`"""
+ state = _get_couch_state()
application = GzipMiddleware(
SoledadTokenAuthMiddleware(SoledadApp(state)))
+ return application(environ, start_response)
+
+def debug_local_application_do_not_use(environ, start_response):
+ """in where we bypass token auth middleware for ease of mind while
+ debugging in your local environment"""
+ state = _get_couch_state()
+ application = SoledadApp(state)
return application(environ, start_response)
+
__version__ = get_versions()['version']
del get_versions