From 1ccd661293337dfe129cdbf52ff7fc6468930ec6 Mon Sep 17 00:00:00 2001 From: Esa Jokinen <58781154+oh2fih@users.noreply.github.com> Date: Sun, 30 Jun 2024 15:32:24 +0300 Subject: [PATCH] Pass DATASOURCE_DBNAME from Configuration() to MongoDBConnection() (#294) --- CveXplore/database/connection/database_connection.py | 4 ++-- CveXplore/main.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CveXplore/database/connection/database_connection.py b/CveXplore/database/connection/database_connection.py index 90de5598..79d67270 100644 --- a/CveXplore/database/connection/database_connection.py +++ b/CveXplore/database/connection/database_connection.py @@ -10,14 +10,14 @@ def __init__(self, database_type: str, database_init_parameters: dict): self.database_type = database_type self.database_init_parameters = database_init_parameters - self._database_connnections = { + self._database_connections = { "mongodb": MongoDBConnection, "api": ApiDatabaseSource, "mysql": SQLBaseConnection, "dummy": DummyConnection, } - self._database_connection = self._database_connnections[self.database_type]( + self._database_connection = self._database_connections[self.database_type]( **self.database_init_parameters ) diff --git a/CveXplore/main.py b/CveXplore/main.py index d760babd..196e2d4c 100644 --- a/CveXplore/main.py +++ b/CveXplore/main.py @@ -149,7 +149,8 @@ def __init__(self, **kwargs): if self.config.DATASOURCE_USER is None and self.config.DATASOURCE_PASSWORD is None else f"{self.config.DATASOURCE_PROTOCOL}://{self.config.DATASOURCE_USER}:{self.config.DATASOURCE_PASSWORD}@{self.config.DATASOURCE_HOST}:{self.config.DATASOURCE_PORT}" - ) + ), + "database": self.config.DATASOURCE_DBNAME, } elif self.datasource_type == "mysql": self._datasource_connection_details = {