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
Built Distribution
Hashes for pydantic-ssm-settings-0.2.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | abacaeee320cc0770e4eafca18789409dca9427163a28cae7dfb04d2ff2b2485 |
|
MD5 | 78f606f21d93a3d78f899ee6d642d938 |
|
BLAKE2b-256 | c2922ac17c1c220a9eb0af39a38e05f11aafb68b7fee4ae4a07eadb3070ad1df |
Hashes for pydantic_ssm_settings-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4878857472109a640155f8a762b5d0b1fa57ad23ec0bbf4e6671f7f2ec75f0cf |
|
MD5 | b9dd9d4f9e59a5112f085a7dab12172c |
|
BLAKE2b-256 | 1c1a52d99786ce15afa37077ec476f9ef800f64769d5e74db74b419ca1f3d467 |