Relative Content

Tag Archive for javascriptconstructorenvironment-variablesdotenv

Dotenvx injected variables not picked up in constructor

I am trying to use an environment variable in a constructor function in Javascript but with no success.After doing some research I found that my issue was similar to this How to make .env variables work inside JS class constructors? but with some few differences. The solution here mentions to use preload in the dotenv library to preload your variables so they are picked up in the constructor. However, when you read the dotenv docs, it is recommended to use the library dotenvx instead