Skip to main content

Replace Pydantic's builtin Secret Support with a configuration provider that loads parameters from AWS Systems Manager Parameter Store.

Project description

pydantic-ssm-settings

Replace Pydantic's builtin Secret Support with a configuration provider that loads parameters from AWS Systems Manager Parameter Store. Parameters are loaded lazily, meaning that they are only requested from AWS if they are not provided via standard field value priority (i.e. initialiser, environment variable, or via .env file).

Usage

The simplest way to use this module is to inhert your settings Config class from AwsSsmSourceConfig. This will overwrite the file_secret_settings settings source with the AwsSsmSettingsSource. Provide a prefix to SSM parameters via the _secrets_dir initialiser value or the secrets_dir Config value.

from pydantic import BaseSettings
from pydantic_ssm_settings import AwsSsmSourceConfig


class WebserviceSettings(BaseSettings):
    some_val: str
    another_val: int

    class Config(AwsSsmSourceConfig):
        ...

SimpleSettings(_secrets_dir='/prod/webservice')

The above example will attempt to retreive values from /prod/webservice/some_val and /prod/webservice/another_val if not provided otherwise.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic-ssm-settings-0.2.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

pydantic_ssm_settings-0.2.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pydantic-ssm-settings-0.2.3.tar.gz.

File metadata

  • Download URL: pydantic-ssm-settings-0.2.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.4 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.9.13

File hashes

Hashes for pydantic-ssm-settings-0.2.3.tar.gz
Algorithm Hash digest
SHA256 822ea12d1c18d255723ccf07a3b4a83ebbbc009f9de9f8def0409e02861ff513
MD5 adfa776c050b9b9e90eb8094736ebc64
BLAKE2b-256 e080e719db7df5c0e2c51f7a7ae8fa87b03a9a0604fa4ddcd60ccb53bd28ee23

See more details on using hashes here.

File details

Details for the file pydantic_ssm_settings-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: pydantic_ssm_settings-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.4 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.9.13

File hashes

Hashes for pydantic_ssm_settings-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e115df6a945cf8c9e11b8eaeec4c14c49c05017eacac1ca5f87d4a0fdabb1afb
MD5 cea107be49bc48beb87eaf6b323f54f6
BLAKE2b-256 d4f97a98d084363ffc0a5bf0aeca83e01e7c9a26834b156099e1f24c4c619da8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page