Keeping Secrets Out of Your Code

A secret typed into the code goes wherever the code goes, GitHub included, so an API reads its secrets from environment variables, keeps them in a .env file that .gitignore leaves out, commits a .env.example instead, stops at startup when one is missing, and rotates any secret that was ever pushed.

By

Updated

Cheat sheet: Keeping Secrets Out of Your Code
Category
FastAPI
Level
Journeyman
Tags
env-file, Environment Variable (python), fastapi, gitignore, Secret Rotation, web-development