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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydantic-ssm-settings-0.2.2.tar.gz
  • Upload date:
  • Size: 4.3 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.2.tar.gz
Algorithm Hash digest
SHA256 0d70eb8ee81694d04e8bf2141dd4d2c9dbaede58c5dac622369a82e196bf41eb
MD5 fa5dca3a5898012f15247c441e405cc1
BLAKE2b-256 a6547e5cb8b270a8fbf7f575643a181dfe3a92a1a50b5d94d3119f102c9537f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydantic_ssm_settings-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 802cc07ec0bd809e0a58ae2e3682222790aa35f3f02a161b30aec27e1c6ab4e7
MD5 0ce1ad8364a2273d0a0753ba33f88720
BLAKE2b-256 55758645ff09f503b68c04f1af3793feef2f110df2bf16a9c76294dfb38756a3

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