chihab/dotenv-run

Loading variables from parent folders

Maximaximum opened this issue · 2 comments

Hi! My angular app lives in a monorepo, and all the environment variables live in the monorepo root folder .env file. Is there a way to make ngx-env/builder load the variable values not from the Angular project root, but from a folder above (or any other custom file)? This is supported by dotenv itself, but does not seem to be supported by ngx-env/builder

Hi!
Could you please provide some resource showing that the feature is supported by dotenv?

The only solution would be to walk up the parent directories until finding a .env file. When should the lookup stop though? Provide a root workspace path in a builder configuration?

A workaround would be to add a symlink to the root .env file from the application project.

The feature is now supported in v16.0.2, env files might be overridden if also present in the application folder once this #44 is merged