Environment variables + .env files
Built into the frameworkPut passwords, addresses, and other settings in environment variables: written in a .env file for local development and supplied by the server or deployment platform in production.
Best forSmall projects with few settings, and containerized deployments.
Avoid whenThere are many settings with complex hierarchy, or configuration must be changed dynamically at runtime.
Simple and direct, supported by every language and platform
Code and configuration are separate, so the same code runs in different environments
Works naturally with Docker and all kinds of deployment platforms
With many settings it gets messy, lacking structure and type checking
.env files contain passwords, which leak if accidentally committed to the code repository
Changing configuration usually requires restarting the program to take effect