I have two projects, dataAdapter
and main_project
placed as follows:
folder:
|___main_project
| |
| |___.env
|
|___Packages
|
|___dataAdapter
The dataAdapter
package is linked to the main_project
using:
npm link "../folder/Packages/dataAdapter"
The main_project
’s project is configured with the dotenv
npm package installed and a dev.env
file. I can access the variables from anywhere in the main_project
project, but not in my local dataAdapter
package.
The .env
file in the main_project
has the following variables:
DB_CLUSTER_URI=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I thought that I can just use process.env.DB_CLUSTER_URI
in the dataAdapter
package, but I got undefined
instead.
Am I doing something wrong? Isn’t the dataAdapter
package running under the same process as the main_project
since it’s linked to it? How can I access the DB_CLUSTER_URI
in the dataAdapter
package from any project that links this package?
Thank you all for your time.