kHRISl33t / runtime-env-cra

Runtime environment handler for create-react-apps
MIT License
49 stars 23 forks source link

Not setting NODE_ENV to development deactivates --env-file flag #8

Closed shkreios closed 3 years ago

shkreios commented 3 years ago

Hey, thank you for this simple but very useful project. Any specific reason why not setting the NODE_ENV to development deactivates the --env-file flag?

Thank you for you time Regards Simon

kHRISl33t commented 3 years ago

Hi @shkreios, thank you for your comment.

I don't see any specific reasons why it should be that way. If a user sets NODE_ENV=development, it will use your local .env file, but if for some reason you have .env.development locally, or you use any other name/alias/prefix/suffix for your env file, you won't be able to set that file if --env-file flag is disabled in development mode. A user should have the option to use whatever file they want until it's a valid env file.

I hope I answered your question. :)

shkreios commented 3 years ago

Hey @kHRISl33t thanks for the fast response.

We are using this tool in our ci/cd for a frontend nx repo with multiple environments with separate .env files (for example staging.env, qa.env) I was just wondering why I had to set NODE_ENV=development in ci/cd for the tool to read the .envfile. But in the context of docker, this does make sense.

Thank you for your time

kHRISl33t commented 3 years ago

Cool, i'm glad you are using it! :)