Problem: Changing code temporarily to support local development


Problem: Changing code temporarily to support local development.

The risk: Accidentally committing the change.

Solution: Read an environment variable to apply the change conditionally.

Hacky alternatives I've seen:

1. Uncommenting a chunk of code that's only useful for local dev purposes.

2. Renaming files to apply a dev-only alternative behavior.

3. Using a querystring that ships to production, which means a prod user could find it.

Instead, use a .env 😎

View original on X