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.4.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

pydantic_ssm_settings-0.2.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydantic-ssm-settings-0.2.4.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/37.2 requests/2.28.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.1 importlib-metadata/4.11.4 keyring/23.9.3 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.13

File hashes

Hashes for pydantic-ssm-settings-0.2.4.tar.gz
Algorithm Hash digest
SHA256 abacaeee320cc0770e4eafca18789409dca9427163a28cae7dfb04d2ff2b2485
MD5 78f606f21d93a3d78f899ee6d642d938
BLAKE2b-256 c2922ac17c1c220a9eb0af39a38e05f11aafb68b7fee4ae4a07eadb3070ad1df

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pydantic_ssm_settings-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4878857472109a640155f8a762b5d0b1fa57ad23ec0bbf4e6671f7f2ec75f0cf
MD5 b9dd9d4f9e59a5112f085a7dab12172c
BLAKE2b-256 1c1a52d99786ce15afa37077ec476f9ef800f64769d5e74db74b419ca1f3d467

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