cli icon indicating copy to clipboard operation
cli copied to clipboard

Allow `.env` files to be ignored by `netlify dev` command

Open aaronransley opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

There is no way to opt-out of the reading of environment variables from .env files in the root of my project directory when running netlify dev.

Describe the solution you'd like

I'd like the ability to use netlify dev without .env files in my project directory being read / considered.

Describe alternatives you've considered

Alternatives at the moment are to avoid using .env files as I have them setup across my project, perhaps renaming them and reconfiguring dotenv-flow to consider the new file names. However, I think this is more complex than netlify dev offering a --ignore-local-env flag or similar.

Additional context

I am using the dotenv-flow methodology of managing .env files, so my .env file doesn't contain local overrides; it instead contains sensible defaults and local overrides exist in .env.local.

Can you submit a pull request?

Yes

aaronransley avatar Sep 23 '21 20:09 aaronransley

Thanks @aaronransley, this is somehow related to https://github.com/netlify/cli/issues/1303.

However, I think you should be able to use .env.development for local overrides per https://github.com/netlify/cli/blob/4fa5d077789b77984457d6b7adb51a6bc3da099b/src/utils/dot-env.js#L21 until we decide on the flow we want to support.

erezrokah avatar Sep 29 '21 16:09 erezrokah

@erezrokah Related? https://github.com/netlify/cli/pull/4321

Soviut avatar Apr 26 '22 06:04 Soviut

Closing as stale. Please re-open if needed

sarahetter avatar Sep 14 '23 19:09 sarahetter