From d82f4f58bacb6e482f38d7ee11ecd9ff675132fe Mon Sep 17 00:00:00 2001 From: Charlene Gilbert Date: Sat, 29 Oct 2016 14:41:16 -0400 Subject: [PATCH] Allow extra mongodb connection settings (ssl, authentication, etc) --- nefertari_mongodb/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nefertari_mongodb/__init__.py b/nefertari_mongodb/__init__.py index cba1609..a67258e 100644 --- a/nefertari_mongodb/__init__.py +++ b/nefertari_mongodb/__init__.py @@ -83,6 +83,6 @@ def includeme(config): def setup_database(config): """ Setup db engine and db itself. Create db if it doesn't exist. """ settings = config.registry.settings - mongoengine.connect(settings['mongodb.db'], - host=settings['mongodb.host'], - port=int(settings['mongodb.port'])) + connect_settings = dict((k[8:], settings[k]) for k in settings if k.startswith('mongodb.') and k != 'mongodb.db') + connect_settings['port'] = int(connect_settings['port']) + mongoengine.connect(settings['mongodb.db'],**connect_settings)