Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes... surely the point of .env file is as a shortcut to provide env vars for local development

.env file shouldn't be used in production, env vars should be injected directly



I agree that is what should happen. That is not what dotenv does though: https://www.npmjs.com/package/dotenv#-documentation


I think dotenv would be fine as long as it doesn't raise exceptions if no .env file is found, i.e. if it works just as a helper for local dev and as a no-op for production

I notice the dotenv docs are recommending dotenvx now in places: https://www.npmjs.com/package/dotenv#-manage-multiple-enviro...


I have seen many .env files in production. SOme junior devs told me it was what they had been taught to do.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: