class documentation

Common configuration parameters shared between all environments.

Read configuration parameters defined in this class, and from ENVIRONMENT variables and from the .env file.

The source priority is changed to the following order:
  1. init_settings
  2. dotenv_settings
  3. env_settings
  4. file_secret_settings
The following environment variables should already be defined:
  • ENVIRONMENT (on all servers)
  • HOSTNAME (on Linux servers only - set by OS)
  • COMPUTERNAME (on Windows servers only - set by OS)
The following secrets should already be defined:
  • service_api_key
  • mongo_url_{environment}
  • rabbit_url_{environment}
Path where your .env and <environment>.env file should be placed:
  • linux: /home/<user>/.local
  • darwin: /home/<user>/.local
  • win32: C:Users<user>AppDataRoamingPython'
Path where your secret files should be placed:
  • linux: /home/<user>/.local/secrets
  • darwin: /home/<user>/.local/secrets
  • win32: C:Users<user>AppDataRoamingPythonsecrets'

You know you are running in Docker when the "/.dockerenv" file exists.

Class Method settings_customise_sources Moved dotenv_settings before env_settings and removed settings_cls since it causes recursion max depth error in this configuration.
Instance Variable env Defined environment variable ENVIRONMENT.
Instance Variable exchange RabbitMQ topic exchange name.
Instance Variable logSeverity RabbitMQ link status log level mappings.
Instance Variable model_config Fixed name used by the BaseSettings class.
Instance Variable serviceApiKey Microservices API key.
Instance Variable watchTopics Messages that require the program name as part of the topic.
Property server Return local server name stripped of possible domain part.
@classmethod
def settings_customise_sources(cls, settings_cls: Type[BaseSettings], init_settings: PydanticBaseSettingsSource, env_settings: PydanticBaseSettingsSource, dotenv_settings: PydanticBaseSettingsSource, file_secret_settings: PydanticBaseSettingsSource) -> Tuple[PydanticBaseSettingsSource, ...]: (source)

Moved dotenv_settings before env_settings and removed settings_cls since it causes recursion max depth error in this configuration.

Defined environment variable ENVIRONMENT.

exchange: str = (source)

RabbitMQ topic exchange name.

logSeverity: dict = (source)

RabbitMQ link status log level mappings.

model_config = (source)

Fixed name used by the BaseSettings class.

serviceApiKey: str = (source)

Microservices API key.

watchTopics: list = (source)

Messages that require the program name as part of the topic.

@computed_field
@property
server: str = (source)

Return local server name stripped of possible domain part.