summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-02-10 01:57:26 +0100
committerKali Kaneko <kali@leap.se>2017-02-10 01:57:26 +0100
commit8a1cbb7bd1ea79408e9ca8f777277d1155f47504 (patch)
tree03ddb9a22fb1513b32a5aae135c60aa8326927db
parentc5388e464907ab0b7192d269173d632af14ae4f1 (diff)
[bug] effectively load the configuration for the app
the code for passing the configuration to the couch initialization was never called. it seems the entrypoint module wasn't finally hooked as expected. I think this fixes the problem, but further review is needed here: either the entrypoint module is to be used, or it better is removed. in the first case, this workaround probably needs to be reverted.
-rw-r--r--server/src/leap/soledad/server/_wsgi.py10
-rw-r--r--server/src/leap/soledad/server/entrypoint.py7
2 files changed, 17 insertions, 0 deletions
diff --git a/server/src/leap/soledad/server/_wsgi.py b/server/src/leap/soledad/server/_wsgi.py
index 37a03ced..f0961eaf 100644
--- a/server/src/leap/soledad/server/_wsgi.py
+++ b/server/src/leap/soledad/server/_wsgi.py
@@ -27,6 +27,7 @@ from leap.soledad.common.backend import SoledadBackend
from leap.soledad.common.couch.state import CouchServerState
from leap.soledad.common.log import getLogger
+from ._config import get_config
__all__ = ['init_couch_state', 'get_sync_resource']
@@ -66,3 +67,12 @@ def get_sync_resource(pool=None):
reactor.callWhenRunning(pool.start)
reactor.addSystemEventTrigger('after', 'shutdown', pool.stop)
return WSGIResource(reactor, pool, wsgi_application)
+
+
+# load configuration from file
+conf = get_config()
+
+# see the comments in application.py recarding why couch state has to be
+# initialized when the reactor is running
+
+reactor.callWhenRunning(init_couch_state, conf)
diff --git a/server/src/leap/soledad/server/entrypoint.py b/server/src/leap/soledad/server/entrypoint.py
index 0bb1c854..9cc1f97b 100644
--- a/server/src/leap/soledad/server/entrypoint.py
+++ b/server/src/leap/soledad/server/entrypoint.py
@@ -17,6 +17,7 @@
"""
The entrypoint for Soledad server.
"""
+
from twisted.internet import reactor
from ._config import get_config
@@ -34,6 +35,12 @@ class SoledadEntrypoint(SoledadSession):
SoledadSession.__init__(self, conf)
+# XXX FIXME ----------------------------
+# this is not executed from anywhere.
+# what's the plan for this module?
+# use me, or delete me.
+# --------------------------------------
# see the comments in application.py recarding why couch state has to be
# initialized when the reactor is running
+
reactor.callWhenRunning(init_couch_state, conf['soledad-server'])