Module documentation

pydantic model bc_configs.BaseConfig[source]

Bases: BaseModel, ABC

Provides to receive values from the environment variables on the validation step of pydantic model.

Show JSON schema
{
   "title": "BaseConfig",
   "description": "Provides to receive values from the environment variables on the validation step of\npydantic model.",
   "type": "object",
   "properties": {}
}

Validators:
  • _populate_from_env » all fields

exception bc_configs.EnvironSourceException[source]

Bases: Exception

Exception raised when there is an issue with the environment source.

pydantic model bc_configs.VaultConfig[source]

Bases: BaseConfig

Configuration for HashiCorp Vault.

Show JSON schema
{
   "title": "VaultConfig",
   "description": "Configuration for HashiCorp Vault.",
   "type": "object",
   "properties": {
      "address": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The address of the Vault server.",
         "title": "Address"
      },
      "mount": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The mount point of the Vault server.",
         "title": "Mount"
      },
      "path": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The path to the secret in the Vault.",
         "title": "Path"
      },
      "token": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The authentication token for accessing the Vault.",
         "title": "Token"
      },
      "username": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The username for authentication (if token is not provided).",
         "title": "Username"
      },
      "password": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The password for authentication (if token is not provided).",
         "title": "Password"
      }
   }
}

Fields:
Validators:
  • _populate_from_env » all fields

field address: str | None = None

The address of the Vault server.

Validated by:
  • _populate_from_env

field mount: str | None = None

The mount point of the Vault server.

Validated by:
  • _populate_from_env

field password: str | None = None

The password for authentication (if token is not provided).

Validated by:
  • _populate_from_env

field path: str | None = None

The path to the secret in the Vault.

Validated by:
  • _populate_from_env

field token: str | None = None

The authentication token for accessing the Vault.

Validated by:
  • _populate_from_env

field username: str | None = None

The username for authentication (if token is not provided).

Validated by:
  • _populate_from_env

has_filled_connect_fields() bool[source]

Check if all connect fields are filled.

Returns:

True if all fields are filled, False otherwise.

Return type:

bool

need_to_use() bool[source]

Check if the token or username and password are provided.

Returns:

True if the token or username and password are provided, False otherwise.

Return type:

bool

bc_configs.define(*, vault_config: VaultConfig | None = None) None[source]

Define the configuration for the application.

Parameters:

vault_config (VaultConfig | None) – The configuration for accessing secrets from a vault. Defaults to None.