summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2013-09-18 11:05:51 -0400
committerKali Kaneko <kali@leap.se>2013-09-18 11:05:51 -0400
commitbdfab552ee6352ae1c4407dd3d46640d77f0389b (patch)
tree16fa4c685344d51b95d918a120cc6773719789e1 /server
parent710130799a2a843309be0306862780f0f108b5dd (diff)
parent4ac07012159bee27dcc57509dd53bfb464cdb1a9 (diff)
Merge remote-tracking branch 'drebs-github/bug/3647_improve-u1db-data-storage-in-couch-2' into develop
Diffstat (limited to 'server')
-rw-r--r--server/changes/feature_3501-add-verification-for-couch-permissions1
-rw-r--r--server/src/leap/soledad/server/__init__.py28
2 files changed, 21 insertions, 8 deletions
diff --git a/server/changes/feature_3501-add-verification-for-couch-permissions b/server/changes/feature_3501-add-verification-for-couch-permissions
new file mode 100644
index 00000000..9206c708
--- /dev/null
+++ b/server/changes/feature_3501-add-verification-for-couch-permissions
@@ -0,0 +1 @@
+ o Verify for couch permissions when starting server. Closes #3501.
diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py
index 67b0611d..b4b715e2 100644
--- a/server/src/leap/soledad/server/__init__.py
+++ b/server/src/leap/soledad/server/__init__.py
@@ -19,12 +19,19 @@
"""
A U1DB server that stores data using CouchDB as its persistence layer.
-This should be run with:
- twistd -n web --wsgi=leap.soledad.server.application --port=2424
+This is written as a Twisted application and intended to be run using the
+twistd command. To start the soledad server, run:
+
+ twistd -n web --wsgi=leap.soledad.server.application --port=X
+
+An initscript is included and will be installed system wide to make it
+feasible to start and stop the Soledad server service using a standard
+interface.
"""
import configparser
+
from u1db.remote import http_app
@@ -116,13 +123,18 @@ def load_configuration(file_path):
# Run as Twisted WSGI Resource
#-----------------------------------------------------------------------------
-conf = load_configuration('/etc/leap/soledad-server.conf')
-state = CouchServerState(conf['couch_url'])
-
-# WSGI application that may be used by `twistd -web`
-application = SoledadTokenAuthMiddleware(SoledadApp(state))
+def application(environ, start_response):
+ conf = load_configuration('/etc/leap/soledad-server.conf')
+ state = CouchServerState(
+ conf['couch_url'],
+ SoledadApp.SHARED_DB_NAME,
+ SoledadTokenAuthMiddleware.TOKENS_DB,
+ SoledadApp.USER_DB_PREFIX)
+ # WSGI application that may be used by `twistd -web`
+ application = SoledadTokenAuthMiddleware(SoledadApp(state))
+ resource = WSGIResource(reactor, reactor.getThreadPool(), application)
+ return application(environ, start_response)
-resource = WSGIResource(reactor, reactor.getThreadPool(), application)
from ._version import get_versions
__version__ = get_versions()['version']