From 87886e8a6da0001e1a6c0f3187d1bf9837dd16ee Mon Sep 17 00:00:00 2001 From: PT <11720165+P-T-I@users.noreply.github.com> Date: Thu, 21 Dec 2023 19:14:01 +0100 Subject: [PATCH] [CveXplore-246] Centralized configuration throughout the lib; paves the way for #241 (#249) --- CveXplore/VERSION | 2 +- CveXplore/alembic/env.py | 2 +- .../ecb1788b7e08_initial_full_model_setup.py | 3 +- CveXplore/cli_cmds/db_cmds/commands.py | 6 +- CveXplore/common/config.py | 39 ++---- CveXplore/common/data_source_connection.py | 19 +-- CveXplore/core/database_indexer/db_indexer.py | 5 +- .../database_maintenance/download_handler.py | 14 ++- .../core/database_maintenance/main_updater.py | 5 +- .../database_maintenance/update_base_class.py | 2 +- .../database_version/db_version_checker.py | 6 +- CveXplore/core/logging/logger_class.py | 2 +- CveXplore/core/nvd_nist/nvd_nist_api.py | 3 +- .../connection/database_connection.py | 6 +- .../database/connection/dummy/__init__.py | 0 CveXplore/database/connection/dummy/dummy.py | 12 ++ .../database/connection/sqlbase/connection.py | 2 +- .../database/connection/sqlbase/sql_base.py | 2 +- CveXplore/main.py | 118 ++++++++++++------ CveXplore/objects/cvexplore_object.py | 3 +- .../single_cve_download_and_proces.py | 2 +- 21 files changed, 147 insertions(+), 106 deletions(-) create mode 100644 CveXplore/database/connection/dummy/__init__.py create mode 100644 CveXplore/database/connection/dummy/dummy.py diff --git a/CveXplore/VERSION b/CveXplore/VERSION index f5b7ffdb..003b7f16 100644 --- a/CveXplore/VERSION +++ b/CveXplore/VERSION @@ -1 +1 @@ -0.3.20.dev12 \ No newline at end of file +0.3.20.dev14 \ No newline at end of file diff --git a/CveXplore/alembic/env.py b/CveXplore/alembic/env.py index afbfe462..5cd7ae0c 100644 --- a/CveXplore/alembic/env.py +++ b/CveXplore/alembic/env.py @@ -12,7 +12,7 @@ from CveXplore.common.config import Configuration from CveXplore.core.database_models.models import CveXploreBase -app_config = Configuration() +app_config = Configuration # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config diff --git a/CveXplore/alembic/versions/ecb1788b7e08_initial_full_model_setup.py b/CveXplore/alembic/versions/ecb1788b7e08_initial_full_model_setup.py index 6e44a6bb..29ccbf67 100644 --- a/CveXplore/alembic/versions/ecb1788b7e08_initial_full_model_setup.py +++ b/CveXplore/alembic/versions/ecb1788b7e08_initial_full_model_setup.py @@ -7,9 +7,8 @@ """ from typing import Sequence, Union -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision: str = "ecb1788b7e08" diff --git a/CveXplore/cli_cmds/db_cmds/commands.py b/CveXplore/cli_cmds/db_cmds/commands.py index 0c97a392..93f347ea 100644 --- a/CveXplore/cli_cmds/db_cmds/commands.py +++ b/CveXplore/cli_cmds/db_cmds/commands.py @@ -38,7 +38,7 @@ def sources_cmd(ctx): @sources_cmd.group("show", invoke_without_command=True, help="Show sources") @click.pass_context def show_cmd(ctx): - config = Configuration() + config = Configuration if ctx.invoked_subcommand is None: printer(input_data=[config.SOURCES]) @@ -56,7 +56,7 @@ def show_cmd(ctx): @click.option("-v", "--value", help="Set the source key value") @click.pass_context def set_cmd(ctx, key, value): - config = Configuration() + config = Configuration sources = config.SOURCES @@ -71,7 +71,7 @@ def set_cmd(ctx, key, value): @sources_cmd.group("reset", invoke_without_command=True, help="Set sources") @click.pass_context def reset_cmd(ctx): - config = Configuration() + config = Configuration sources = config.DEFAULT_SOURCES diff --git a/CveXplore/common/config.py b/CveXplore/common/config.py index 99854e59..55971a2a 100644 --- a/CveXplore/common/config.py +++ b/CveXplore/common/config.py @@ -5,30 +5,8 @@ import ast import json import os -import shutil from json import JSONDecodeError -from dotenv import load_dotenv - -if not os.path.exists(os.path.expanduser("~/.cvexplore")): - os.mkdir(os.path.expanduser("~/.cvexplore")) - -user_wd = os.path.expanduser("~/.cvexplore") - -if not os.path.exists(os.path.join(user_wd, ".env")): - shutil.copyfile( - os.path.join(os.path.dirname(__file__), ".env_example"), - os.path.join(user_wd, ".env"), - ) - -load_dotenv(os.path.join(user_wd, ".env")) - -if not os.path.exists(os.path.join(user_wd, ".sources.ini")): - shutil.copyfile( - os.path.join(os.path.dirname(__file__), ".sources.ini"), - os.path.join(user_wd, ".sources.ini"), - ) - def getenv_bool(name: str, default: str = "False"): raw = os.getenv(name, default).title() @@ -80,7 +58,7 @@ class Configuration(object): Class holding the configuration """ - USER_HOME_DIR = user_wd + USER_HOME_DIR = os.path.expanduser("~/.cvexplore") CVE_START_YEAR = int(os.getenv("CVE_START_YEAR", 2000)) @@ -89,7 +67,7 @@ class Configuration(object): # Which datasource to query.Currently supported options include: # - mongodb # - api - DATASOURCE = os.getenv("DATASOURCE", "mongodb") + DATASOURCE_TYPE = os.getenv("DATASOURCE_TYPE", "mongodb") DATASOURCE_PROTOCOL = os.getenv("DATASOURCE_PROTOCOL", "mongodb") DATASOURCE_DBAPI = os.getenv("DATASOURCE_DBAPI", None) @@ -104,6 +82,8 @@ class Configuration(object): DATASOURCE_PASSWORD = os.getenv("DATASOURCE_PASSWORD", "cvexplore") DATASOURCE_DBNAME = os.getenv("DATASOURCE_DBNAME", "cvexplore") + DATASOURCE_CONNECTION_DETAILS = None + SQLALCHEMY_DATABASE_URI = os.getenv( "SQLALCHEMY_DATABASE_URI", f"{DATASOURCE_PROTOCOL}://{DATASOURCE_USER}:{DATASOURCE_PASSWORD}@{DATASOURCE_HOST}:{DATASOURCE_PORT}/{DATASOURCE_DBNAME}" @@ -118,13 +98,15 @@ class Configuration(object): ) # keep these for now to maintain backwards compatibility + API_CONNECTION_DETAILS = None + MONGODB_CONNECTION_DETAILS = None MONGODB_HOST = os.getenv("MONGODB_HOST", "127.0.0.1") MONGODB_PORT = int(os.getenv("MONGODB_PORT", 27017)) if os.getenv("SOURCES") is not None: SOURCES = getenv_dict("SOURCES", None) else: - with open(os.path.join(user_wd, ".sources.ini")) as f: + with open(os.path.join(USER_HOME_DIR, ".sources.ini")) as f: SOURCES = json.loads(f.read()) NVD_NIST_API_KEY = os.getenv("NVD_NIST_API_KEY", None) @@ -140,7 +122,9 @@ class Configuration(object): } LOGGING_TO_FILE = getenv_bool("LOGGING_TO_FILE", "True") - LOGGING_FILE_PATH = os.getenv("LOGGING_FILE_PATH", os.path.join(user_wd, "log")) + LOGGING_FILE_PATH = os.getenv( + "LOGGING_FILE_PATH", os.path.join(USER_HOME_DIR, "log") + ) if not os.path.exists(LOGGING_FILE_PATH): os.mkdir(LOGGING_FILE_PATH) @@ -165,3 +149,6 @@ class Configuration(object): GELF_SYSLOG_ADDITIONAL_FIELDS = getenv_dict("GELF_SYSLOG_ADDITIONAL_FIELDS", None) MAX_DOWNLOAD_WORKERS = int(os.getenv("MAX_DOWNLOAD_WORKERS", 10)) + + def __repr__(self): + return f"<< CveXploreConfiguration >>" diff --git a/CveXplore/common/data_source_connection.py b/CveXplore/common/data_source_connection.py index 2c8b901f..2dffa303 100644 --- a/CveXplore/common/data_source_connection.py +++ b/CveXplore/common/data_source_connection.py @@ -5,9 +5,7 @@ import json import os -from CveXplore.api.connection.api_db import ApiDatabaseSource from CveXplore.database.connection.database_connection import DatabaseConnection -from CveXplore.database.connection.mongodb.mongo_db import MongoDBConnection from CveXplore.objects.cvexplore_object import CveXploreObject @@ -19,19 +17,10 @@ class DatasourceConnection(CveXploreObject): # hack for documentation building if json.loads(os.getenv("DOC_BUILD"))["DOC_BUILD"] != "YES": - try: - __DATA_SOURCE_CONNECTION = ( - ApiDatabaseSource(**json.loads(os.getenv("API_CON_DETAILS"))) - if os.getenv("API_CON_DETAILS") - else MongoDBConnection(**json.loads(os.getenv("MONGODB_CON_DETAILS"))) - ) - except TypeError: - __DATA_SOURCE_CONNECTION = DatabaseConnection( - database_type=os.getenv("DATASOURCE_TYPE"), - database_init_parameters=json.loads( - os.getenv("DATASOURCE_CON_DETAILS") - ), - ).database_connection + __DATA_SOURCE_CONNECTION = DatabaseConnection( + database_type="dummy", + database_init_parameters={}, + ).database_connection def to_dict(self, *print_keys: str) -> dict: """ diff --git a/CveXplore/core/database_indexer/db_indexer.py b/CveXplore/core/database_indexer/db_indexer.py index 28e26883..620221e1 100644 --- a/CveXplore/core/database_indexer/db_indexer.py +++ b/CveXplore/core/database_indexer/db_indexer.py @@ -4,6 +4,7 @@ from CveXplore.core.database_maintenance.update_base_class import UpdateBaseClass from CveXplore.core.general.utils import sanitize +from CveXplore.database.connection.base.db_connection_base import DatabaseConnectionBase MongoUniqueIndex = namedtuple("MongoUniqueIndex", "index name unique") MongoAddIndex = namedtuple("MongoAddIndex", "index name") @@ -14,8 +15,8 @@ class DatabaseIndexer(UpdateBaseClass): Class processing the Mongodb indexes """ - def __init__(self, datasource): - super().__init__(__name__) + def __init__(self, datasource: DatabaseConnectionBase): + super().__init__(logger_name=__name__) database = datasource self.database = database.dbclient diff --git a/CveXplore/core/database_maintenance/download_handler.py b/CveXplore/core/database_maintenance/download_handler.py index b29fb338..972338f6 100644 --- a/CveXplore/core/database_maintenance/download_handler.py +++ b/CveXplore/core/database_maintenance/download_handler.py @@ -4,7 +4,6 @@ """ import datetime import gzip -import json import logging import os import sys @@ -46,8 +45,13 @@ class DownloadHandler(ABC): Each download script has a derived class which handles specifics for that type of content / download. """ - def __init__(self, feed_type: str, logger_name: str, prefix: str = None): - self.config = Configuration() + def __init__( + self, + feed_type: str, + logger_name: str, + prefix: str = None, + ): + self.config = Configuration self._end = None @@ -67,8 +71,8 @@ def __init__(self, feed_type: str, logger_name: str, prefix: str = None): self.do_process = True database = DatabaseConnection( - database_type=self.config.DATASOURCE, - database_init_parameters=json.loads(os.getenv("DATASOURCE_CON_DETAILS")), + database_type=self.config.DATASOURCE_TYPE, + database_init_parameters=self.config.DATASOURCE_CONNECTION_DETAILS, ).database_connection self.database = database.dbclient diff --git a/CveXplore/core/database_maintenance/main_updater.py b/CveXplore/core/database_maintenance/main_updater.py index 6497c20b..226bd88f 100644 --- a/CveXplore/core/database_maintenance/main_updater.py +++ b/CveXplore/core/database_maintenance/main_updater.py @@ -18,6 +18,7 @@ from CveXplore.core.database_maintenance.update_base_class import UpdateBaseClass from CveXplore.core.database_version.db_version_checker import DatabaseVersionChecker from CveXplore.core.logging.logger_class import AppLogger +from CveXplore.database.connection.base.db_connection_base import DatabaseConnectionBase from CveXplore.errors import UpdateSourceNotFound logging.setLoggerClass(AppLogger) @@ -28,11 +29,11 @@ class MainUpdater(UpdateBaseClass): The MainUpdater class is the main class for performing database database_maintenance tasks """ - def __init__(self, datasource): + def __init__(self, datasource: DatabaseConnectionBase): """ Init a new MainUpdater class """ - super().__init__(__name__) + super().__init__(logger_name=__name__) self.datasource = datasource diff --git a/CveXplore/core/database_maintenance/update_base_class.py b/CveXplore/core/database_maintenance/update_base_class.py index 7ef5d314..fdb1851d 100644 --- a/CveXplore/core/database_maintenance/update_base_class.py +++ b/CveXplore/core/database_maintenance/update_base_class.py @@ -8,7 +8,7 @@ class UpdateBaseClass(object): def __init__(self, logger_name: str): - self.config = Configuration() + self.config = Configuration self.logger = logging.getLogger(logger_name) self.logger.removeHandler(self.logger.handlers[0]) diff --git a/CveXplore/core/database_version/db_version_checker.py b/CveXplore/core/database_version/db_version_checker.py index 0cdfa231..9a25e5aa 100644 --- a/CveXplore/core/database_version/db_version_checker.py +++ b/CveXplore/core/database_version/db_version_checker.py @@ -2,14 +2,16 @@ import os from CveXplore.core.database_maintenance.update_base_class import UpdateBaseClass +from CveXplore.database.connection.base.db_connection_base import DatabaseConnectionBase from CveXplore.errors import DatabaseSchemaVersionError runPath = os.path.dirname(os.path.realpath(__file__)) class DatabaseVersionChecker(UpdateBaseClass): - def __init__(self, datasource): - super().__init__(__name__) + def __init__(self, datasource: DatabaseConnectionBase): + super().__init__(logger_name=__name__) + with open(os.path.join(runPath, "../../.schema_version")) as f: self.schema_version = json.loads(f.read()) diff --git a/CveXplore/core/logging/logger_class.py b/CveXplore/core/logging/logger_class.py index b8072794..9addbbfc 100644 --- a/CveXplore/core/logging/logger_class.py +++ b/CveXplore/core/logging/logger_class.py @@ -32,7 +32,7 @@ def __init__(self, name, level=logging.NOTSET): self.formatter = TaskFormatter( "%(asctime)s - %(task_name)s - %(name)-8s - %(levelname)-8s - [%(task_id)s] %(message)s" ) - self.config = Configuration() + self.config = Configuration root = logging.getLogger() diff --git a/CveXplore/core/nvd_nist/nvd_nist_api.py b/CveXplore/core/nvd_nist/nvd_nist_api.py index 9607ddf5..31c98028 100644 --- a/CveXplore/core/nvd_nist/nvd_nist_api.py +++ b/CveXplore/core/nvd_nist/nvd_nist_api.py @@ -331,6 +331,7 @@ def retry_policy(info: RetryInfo) -> RetryPolicyStrategy: class ApiDataIterator(object): def __init__(self, api_data: ApiData): self.logger = logging.getLogger(__name__) + self.config = Configuration self._page_length = api_data.results_per_page self._total_results = api_data.total_results @@ -350,8 +351,6 @@ def __init__(self, api_data: ApiData): self.workload = None - self.config = Configuration() - def __iter__(self): return self diff --git a/CveXplore/database/connection/database_connection.py b/CveXplore/database/connection/database_connection.py index e6772c43..90de5598 100644 --- a/CveXplore/database/connection/database_connection.py +++ b/CveXplore/database/connection/database_connection.py @@ -1,7 +1,8 @@ from CveXplore.api.connection.api_db import ApiDatabaseSource from CveXplore.database.connection.base.db_connection_base import DatabaseConnectionBase +from CveXplore.database.connection.dummy.dummy import DummyConnection from CveXplore.database.connection.mongodb.mongo_db import MongoDBConnection -from CveXplore.database.connection.sqlbase.sql_base import SQLBase +from CveXplore.database.connection.sqlbase.sql_base import SQLBaseConnection class DatabaseConnection(object): @@ -12,7 +13,8 @@ def __init__(self, database_type: str, database_init_parameters: dict): self._database_connnections = { "mongodb": MongoDBConnection, "api": ApiDatabaseSource, - "mysql": SQLBase, + "mysql": SQLBaseConnection, + "dummy": DummyConnection, } self._database_connection = self._database_connnections[self.database_type]( diff --git a/CveXplore/database/connection/dummy/__init__.py b/CveXplore/database/connection/dummy/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/CveXplore/database/connection/dummy/dummy.py b/CveXplore/database/connection/dummy/dummy.py new file mode 100644 index 00000000..1e671cda --- /dev/null +++ b/CveXplore/database/connection/dummy/dummy.py @@ -0,0 +1,12 @@ +from CveXplore.database.connection.base.db_connection_base import DatabaseConnectionBase + + +class DummyConnection(DatabaseConnectionBase): + def __init__(self, **kwargs): + super().__init__(logger_name=__name__) + + self._dbclient = {"schema": "test"} + + @property + def dbclient(self): + return self._dbclient diff --git a/CveXplore/database/connection/sqlbase/connection.py b/CveXplore/database/connection/sqlbase/connection.py index acbfb552..8b891ffd 100644 --- a/CveXplore/database/connection/sqlbase/connection.py +++ b/CveXplore/database/connection/sqlbase/connection.py @@ -3,7 +3,7 @@ from CveXplore.common.config import Configuration -config = Configuration() +config = Configuration engine = create_engine(config.SQLALCHEMY_DATABASE_URI, echo=True) diff --git a/CveXplore/database/connection/sqlbase/sql_base.py b/CveXplore/database/connection/sqlbase/sql_base.py index 57ca39a0..6a495fa6 100644 --- a/CveXplore/database/connection/sqlbase/sql_base.py +++ b/CveXplore/database/connection/sqlbase/sql_base.py @@ -1,7 +1,7 @@ from CveXplore.database.connection.base.db_connection_base import DatabaseConnectionBase -class SQLBase(DatabaseConnectionBase): +class SQLBaseConnection(DatabaseConnectionBase): def __init__(self, **kwargs): super().__init__(logger_name=__name__) diff --git a/CveXplore/main.py b/CveXplore/main.py index b1675b2c..e0015c9a 100644 --- a/CveXplore/main.py +++ b/CveXplore/main.py @@ -2,10 +2,34 @@ Main ==== """ +import os +import shutil + +from dotenv import load_dotenv + +if not os.path.exists(os.path.expanduser("~/.cvexplore")): + os.mkdir(os.path.expanduser("~/.cvexplore")) + +user_wd = os.path.expanduser("~/.cvexplore") + +if not os.path.exists(os.path.join(user_wd, ".env")): + shutil.copyfile( + os.path.join(os.path.dirname(__file__), ".env_example"), + os.path.join(user_wd, ".env"), + ) + +load_dotenv(os.path.join(user_wd, ".env")) + +if not os.path.exists(os.path.join(user_wd, ".sources.ini")): + shutil.copyfile( + os.path.join(os.path.dirname(__file__), ".sources.ini"), + os.path.join(user_wd, ".sources.ini"), + ) + import functools import json import logging -import os + import re import warnings from collections import defaultdict @@ -21,12 +45,12 @@ from CveXplore.core.database_migration.database_migrator import DatabaseMigrator from CveXplore.core.general.datasources import supported_datasources from CveXplore.database.connection.database_connection import DatabaseConnection -from CveXplore.database.connection.mongodb.mongo_db import MongoDBConnection from CveXplore.errors import DatabaseIllegalCollection from CveXplore.errors.datasource import UnsupportedDatasourceException from CveXplore.errors.validation import CveNumberValidationError from CveXplore.objects.cvexplore_object import CveXploreObject + try: from version import VERSION except ModuleNotFoundError: @@ -41,13 +65,7 @@ class CveXplore(object): Main class for CveXplore package """ - def __init__( - self, - datasource_type: str = None, - datasource_connection_details: dict = None, - mongodb_connection_details: dict = None, - api_connection_details: dict = None, - ): + def __init__(self, **kwargs): """ Create a new instance of CveXplore :param datasource_type: Which datasource to query. @@ -64,16 +82,20 @@ def __init__( documentation. """ self.__version = VERSION - self.config = Configuration() + self._config = Configuration self.logger = logging.getLogger(__name__) - self.datasource_type = ( - datasource_type if datasource_type is not None else self.config.DATASOURCE - ) - self._datasource_connection_details = datasource_connection_details + # adjust self.config with kwargs parameters; lower case parameters are converted to uppercase and then changed + # in the self.config object + for each in kwargs: + setattr(self.config, each.upper(), kwargs[each]) + + self._datasource_type = self.config.DATASOURCE_TYPE - self._mongodb_connection_details = mongodb_connection_details - self._api_connection_details = api_connection_details + self._datasource_connection_details = self.config.DATASOURCE_CONNECTION_DETAILS + + self._mongodb_connection_details = self.config.MONGODB_CONNECTION_DETAILS + self._api_connection_details = self.config.API_CONNECTION_DETAILS os.environ["DOC_BUILD"] = json.dumps({"DOC_BUILD": "NO"}) @@ -90,40 +112,56 @@ def __init__( raise ValueError( "Missing datasource_connection_details for selected datasource ('api')" ) - - if self.mongodb_connection_details is not None: + elif self.datasource_type == "api": + self.datasource_connection_details[ + "user_agent" + ] = f"CveXplore:{self.version}" + + if ( + self.mongodb_connection_details is not None + and self.datasource_type == "mongodb" + ): self.logger.warning( "The use of mongodb_connection_details is deprecated and will be removed in the 0.4 release, please " "use datasource_connection_details instead" ) - os.environ["MONGODB_CON_DETAILS"] = json.dumps( - self.mongodb_connection_details - ) - self.datasource = MongoDBConnection(**self.mongodb_connection_details) - self.database = MainUpdater(datasource=self.datasource) - elif self.api_connection_details is not None: + self._datasource_connection_details = self.mongodb_connection_details + elif self.api_connection_details is not None and self.datasource_type == "api": self.logger.warning( "The use of api_connection_details is deprecated and will be removed in the 0.4 release, please " "use datasource_connection_details instead" ) - self.api_connection_details["user_agent"] = f"CveXplore:{self.version}" - os.environ["API_CON_DETAILS"] = json.dumps(self.api_connection_details) - self.datasource = ApiDatabaseSource(**self.api_connection_details) + self._datasource_connection_details = self.api_connection_details else: - # by default assume we are talking to a mongodb database - datasource_connection_details = { - "host": f"{self.config.DATASOURCE_PROTOCOL}://{self.config.DATASOURCE_HOST}:{self.config.DATASOURCE_PORT}" - } - os.environ["DATASOURCE_TYPE"] = self.datasource_type - os.environ["DATASOURCE_CON_DETAILS"] = json.dumps( - datasource_connection_details + if self.datasource_type == "mongodb": + self._datasource_connection_details = { + "host": f"{self.config.DATASOURCE_PROTOCOL}://{self.config.DATASOURCE_HOST}:{self.config.DATASOURCE_PORT}" + } + elif self.datasource_type == "mysql": + self._datasource_connection_details = { + "sql_uri": self.config.SQLALCHEMY_DATABASE_URI + } + elif self.datasource_type == "api": + self._datasource_connection_details = { + "address": ( + f"{self.config.DATASOURCE_HOST}", + int(f"{self.config.DATASOURCE_PORT}"), + ), + "api_path": "api", + } + + setattr( + self.config, + "DATASOURCE_CONNECTION_DETAILS", + self.datasource_connection_details, ) self.datasource = DatabaseConnection( database_type=self.datasource_type, - database_init_parameters=datasource_connection_details, + database_init_parameters=self.datasource_connection_details, ).database_connection - self.database = MainUpdater(datasource=self.datasource) + if self.datasource_type != "api": + self.database = MainUpdater(datasource=self.datasource) self.database_migrator = DatabaseMigrator() @@ -143,6 +181,14 @@ def __init__( self.logger.info(f"Initialized CveXplore version: {self.version}") + @property + def config(self): + return self._config + + @property + def datasource_type(self) -> str: + return self._datasource_type + @property def datasource_connection_details(self): return self._datasource_connection_details diff --git a/CveXplore/objects/cvexplore_object.py b/CveXplore/objects/cvexplore_object.py index 440bbe80..7dbe7d79 100644 --- a/CveXplore/objects/cvexplore_object.py +++ b/CveXplore/objects/cvexplore_object.py @@ -2,7 +2,6 @@ CveXploreObject =============== """ -from CveXplore.common.config import Configuration class CveXploreObject(object): @@ -11,7 +10,7 @@ class CveXploreObject(object): """ def __init__(self): - self.config = Configuration() + pass def __repr__(self) -> str: return f"<< {self.__class__.__name__} >>" diff --git a/debug_scripts/single_cve_download_and_proces.py b/debug_scripts/single_cve_download_and_proces.py index e197bd03..9a34a70b 100644 --- a/debug_scripts/single_cve_download_and_proces.py +++ b/debug_scripts/single_cve_download_and_proces.py @@ -5,7 +5,7 @@ from CveXplore.core.database_maintenance.sources_process import CVEDownloads from CveXplore.core.nvd_nist.nvd_nist_api import NvdNistApi -config = Configuration() +config = Configuration os.environ["MONGODB_CON_DETAILS"] = json.dumps( {