NestCrafts / nestjs-easyconfig

Manage nestjs configs on the go 🔥
188 stars 18 forks source link

Config should not require a path #152

Open genu opened 4 years ago

genu commented 4 years ago

This is more design related.

Current behavior is that you must pass an env file to load through the path property.

However, in a production environment, it is recommended that the .env NOT be committed to the repository, as per https://github.com/motdotla/dotenv#should-i-commit-my-env-file

we're using dotenv() under the hood, so I think that there should be a fall back case where if there is no path that is passed in, dotenv should just load the env variables directly from the system (which is the recommended way, anyway).

Any thoughts?

rubiin commented 4 years ago

Env files are not commited to repo rather created or supplied from another source.

genu commented 4 years ago

The current flow is that the .env files are required to be passed in though, is it not?

If you don't pass an .env file to the EasyConfig Module, it will throw an error.

btd1337 commented 1 year ago

The expected operation is that if the .env file isn't present, the library will try to access the host's environment variables.

This is how nestjs-config works.

Currently this library does not work in production!