Env vars phù hợp cấu hình không nhạy cảm hoặc secret đã được inject từ secret manager. Không nên commit .env chứa production secrets. Với Compose, có thể dùng env_file cho local và secrets/file mount cho dữ liệu nhạy cảm.
Ví dụ Compose local:
services:
api:
image: my-api
env_file:
- .env.local
environment:
NODE_ENV: developmentProduction nên dùng secret manager của platform, rotation policy và least privilege.
Image không được chứa secret baked-in ở build time.
Environment variables fit non-sensitive configuration or secrets injected from a secret manager. Do not commit .env files with production secrets. With Compose, env_file can be used for local development and secrets/file mounts for sensitive data.
Local Compose example:
services:
api:
image: my-api
env_file:
- .env.local
environment:
NODE_ENV: developmentProduction should use the platform secret manager, rotation policy and least privilege.
Images must not contain secrets baked in at build time.