Settings

CveXplore by default looks for an .env file in ${HOME}/.cvexplore folder. If certain values need to be overwritten you can do it either there or pass them directly as environment variables.

The following config variables are the configuration settings for the database.

Common

DATASOURCE_TYPE : str = 'mysql'

This actually defaults to mongodb but that breaks the documentation automation.

Available options: mongodb, api, mysql.

DATASOURCE_PROTOCOL : str = 'mysql'

This actually defaults to mongodb but that breaks the documentation automation.

Used to build the URL; e.g., mongodb, https or http`.

DATASOURCE_DBAPI : str = 'pymysql'

This actually defaults to None but that breaks the documentation automation.

DBAPI extension for the protocol. E.g. srv in mongodb+srv:// or pymysql in mysql+pymysql://.

DATASOURCE_USER : None = None

Username for the data source (database or API).

DATASOURCE_PASSWORD : None = None

Password for the data source (database or API).

DATASOURCE_DBNAME : str = 'cvedb'

Database name at the data source.

DATASOURCE_CONNECTION_DETAILS : None = None

Not configurable via environment variables.

By default automatically built from the settings that are appropriate for the selected DATASOURCE_TYPE, but documented here as this can be overwritten in the code using CveXplore as a library, which would cause many of these settings not to be honored.

API_CONNECTION_DETAILS : None = None

Not configurable via environment variables.

Deprecated (replaced by DATASOURCE_CONNECTION_DETAILS). Will be removed in the 0.4 release.

MongoDB

MONGODB_HOST : str = '127.0.0.1'

MongoDB hostname (without the protocal that should be defined with DATASOURCE_PROTOCOL & DATASOURCE_DBAPI).

MONGODB_PORT : int = 27017

MongoDB port number.

MONGODB_CONNECTION_DETAILS : None = None

Not configurable via environment variables.

Deprecated (replaced by DATASOURCE_CONNECTION_DETAILS). Will be removed in the 0.4 release.

SQL

SQLALCHEMY_DATABASE_URI : str = 'mysql+pymysql://None:None@127.0.0.1:27017/cvedb'

Built from other environment variables, but can be manually overwritten.

Defaults to {DATASOURCE_PROTOCOL}[+{DATASOURCE_DBAPI}]://{DATASOURCE_USER}:{DATASOURCE_PASSWORD}@{DATASOURCE_HOST}:{DATASOURCE_PORT}/{DATASOURCE_DBNAME}.

SQLALCHEMY_TRACK_MODIFICATIONS : bool = False

See https://docs.sqlalchemy.org/en/20/orm/session_events.html

SQLALCHEMY_ENGINE_OPTIONS : dict = {'pool_recycle': 299, 'pool_timeout': 20}

See https://docs.sqlalchemy.org/en/20/core/engines.html


Last update: Aug 11, 2024