In my project I want the server to dynamically use a database based on an environment variable DATABASE
. Depending on this variable I would load the files specific for that database from under a folder with the database name. (mongodb -> server/mongodb/file.js)
I set up an environment variable (DATABASE="mongodb"
) for the node server using noemon so for example when I load a database file I use require('./'+process.env.DATABASE+'/file')
.
Now my question is if I can configure gulp-jasmine with an environment variable?
Right now all my tests fail since the path resolves to ./undefined/file.
Right click the Computer icon on your desktop and choose Properties from the menu. Click on the Advanced system settings link and then click Environment Variables. Under the section System Variables, select the environment variable you want to edit, and click Edit.
You should either be able to launch your gulp task with the env variable set: DATABASE=mongodb gulp jasmine
or set it within your gulp task process.env.DATABASE = "mongodb"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With