From fc5ea9d6d1ec34f72f470b01a3bc9a529866d785 Mon Sep 17 00:00:00 2001 From: andrei Date: Tue, 15 Mar 2022 15:50:02 +0200 Subject: [PATCH] added back config for localmongodb --- planetmint/__init__.py | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/planetmint/__init__.py b/planetmint/__init__.py index 36a6606..513c766 100644 --- a/planetmint/__init__.py +++ b/planetmint/__init__.py @@ -9,8 +9,6 @@ import os from planetmint.log import DEFAULT_LOGGING_CONFIG as log_config from planetmint.version import __version__ # noqa - - # from functools import reduce # PORT_NUMBER = reduce(lambda x, y: x * y, map(ord, 'Planetmint')) % 2**16 # basically, the port number is 9984 @@ -22,8 +20,31 @@ from planetmint.version import __version__ # noqa _database_keys_map = { # TODO Check if it is working after removing 'name' field 'tarantool_db': ('host', 'port'), + 'localmongodb': ('host', 'port', 'name') } +_base_database_localmongodb = { + 'host': 'localhost', + 'port': 27017, + 'name': 'bigchain', + 'replicaset': None, + 'login': None, + 'password': None, +} + +_database_localmongodb = { + 'backend': 'localmongodb', + 'connection_timeout': 5000, + 'max_tries': 3, + 'ssl': False, + 'ca_cert': None, + 'certfile': None, + 'keyfile': None, + 'keyfile_passphrase': None, + 'crlfile': None, +} +_database_localmongodb.update(_base_database_localmongodb) + _base_database_tarantool_local_db = { # TODO Rewrite this configs for tarantool usage 'host': 'localhost', 'port': 3301, @@ -56,9 +77,9 @@ _database_tarantool = { } _database_tarantool.update(_base_database_tarantool_local_db) - _database_map = { - 'tarantool_db': _database_tarantool + 'tarantool_db': _database_tarantool, + 'localmongodb': _database_localmongodb } config = { 'server': { @@ -83,7 +104,7 @@ config = { 'version': 'v0.31.5', # look for __tm_supported_versions__ }, # TODO Maybe remove hardcode configs for tarantool (review) - 'database': _database_map['tarantool_db'], + 'database': _database_map, 'log': { 'file': log_config['handlers']['file']['filename'], 'error_file': log_config['handlers']['errors']['filename'],