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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydantic-ssm-settings-0.0.1.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.0.1.tar.gz
Algorithm Hash digest
SHA256 1723b0f088cebd26199165730f382b6c7c1e2aa44e55ed32107f9cb8ab742684
MD5 2cb028092bf0390bf706e63021b19861
BLAKE2b-256 f37f2a3dba9320794d3e0ecef29b1b93846a7c14bd54987b59cb529ffd2c6dad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydantic_ssm_settings-0.0.1-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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 416abe2ce2747ff10dab62af0bcf7642ed27fb2d204ecb427ac310a297ff4dda
MD5 92b6eac6f62bc1723a12f93c62e4e7fc
BLAKE2b-256 20963e2dfb788aa5bfe5eca968e1991450d270c71718090a9ff0450f38d0bcff

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