razvanz razvanz - 1 year ago 190
Node.js Question

How to set environment variable for gulp-jasmine

In my project I want the server to dynamically use a database based on an environment variable

. 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 (
) for the node server using noemon so for example when I load a database file I use

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.

Answer Source

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".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download