Skip to content

Instantly share code, notes, and snippets.

View DomWeldon's full-sized avatar
🤠
today I'll be mostly updating my github status

Dom Weldon DomWeldon

🤠
today I'll be mostly updating my github status
  • Software Engineer & Architect
  • London, United Kingdom
View GitHub Profile
@DomWeldon
DomWeldon / crudrouter.py
Last active June 24, 2022 15:38
CRUD Router
# Standard Library
from typing import (
Any,
Callable,
Dict,
FrozenSet,
List,
Optional,
Sequence,
Set,
@DomWeldon
DomWeldon / README.md
Last active January 25, 2023 17:39
SSM + pydantic: ARNs in environment variables are queried at load time

SSM + Pydantic

Query values from SSM when deployed, by placing an SSM ARN as the environment variable

Background

I wanted to query secrets from SSM at runtime, to laod them into a pydantic.BaseSettings settings object, but still be able to pass standard values during development (and I guess, if I want, in prod).

I've done a couple of similar implementations before, but they have always felt clunky and involved altering the object after instantiation, or hard coding which values to take out of SSM.

Presidency President Wikipedia Entry Took office Left office Party Portrait Thumbnail Home State
1 George Washington http://en.wikipedia.org/wiki/George_Washington 30/04/1789 4/03/1797 Independent GeorgeWashington.jpg thmb_GeorgeWashington.jpg Virginia
2 John Adams http://en.wikipedia.org/wiki/John_Adams 4/03/1797 4/03/1801 Federalist JohnAdams.jpg thmb_JohnAdams.jpg Massachusetts
3 Thomas Jefferson http://en.wikipedia.org/wiki/Thomas_Jefferson 4/03/1801 4/03/1809 Democratic-Republican Thomasjefferson.gif thmb_Thomasjefferson.gif Virginia
4 James Madison http://en.wikipedia.org/wiki/James_Madison 4/03/1809 4/03/1817 Democratic-Republican JamesMadison.gif thmb_JamesMadison.gif Virginia
5 James Monroe http://en.wikipedia.org/wiki/James_Monroe 4/03/1817 4/03/1825 Democratic-Republican JamesMonroe.gif thmb_JamesMonroe.gif Virginia
6 John Quincy Adams http://en.wikipedia.org/wiki/John_Quincy_Adams 4/03/1825 4/03/1829 Democratic-Republican/National Republican JohnQuincyAdams.gif thmb_JohnQuincyAdams.gif