Ga naar de hoofdinhoud

Separate config from code

Refactor environment-specific values into deploy-time configuration with validation and safe defaults.

full-stack-development5 min read

Staging and production share a hardcoded analytics project ID in application code. Twelve-Factor config: values that vary between deploys belong in environment configuration, validated before runtime work begins. Hardcoded environment values make the same commit behave differently only after someone edits code, and secrets can accidentally leak into browser bundles. Identify deploy-varying values List analytics IDs, API base URLs, service tokens, webhook secrets, and feature rollout values. The first filter is whether the value changes between local, preview, staging, and production. Move values to environment config Read server-only values from process.env and expose only intentional public values with a public…

Read the full lesson

Sign up free: one personalized lesson every day, matched to your role and goals.

← Back to library

Neem contact op