Comment

Comment by thinkxl

.env files are a different use case than config files.

You can use them together. Config files provide configuration to the application. The config file can read environment variables, so you can deploy the same code across different environments, e.g., your local computer, staging, and production.

Then, each environment will provide system-related configuration, e.g., `DATABASE_URL`.

With this setup, the same code will work on each environment.

Now, .env files should live only on your local machine; on any other environment, they should be set differently, not in files.

The .env file is a convenience, but not the only option for environment variables, nowdays you can use 1Password too.

parent thinkxl 7 months ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton