0

I'm developping a node application, sometimes with Eclipse (locally) and sometimes with Cloud9 (remotely). As I'm using a database, I have one local with mongoDB and another remote on mongoHQ.

If I dont want to use the DB on mongoHQ when I work locally, how could I tell my nodejs application (understand automatically detect) that my IDE is Cloud9 or another one ? I could use a simple local variable that I change each time I change IDE, but is it possible to do it automatically ?

4

1 回答 1

0

检测的一种方法是检查是否C9_PROJECT设置了环境变量:

if (process.env.C9_PROJECT) {
  console.log('Running on C9 IDE');
} else {
  // ...
}

还有其他以C9为前缀的变量。如果你愿意,你可以检查它们。

于 2013-10-16T18:36:29.123 回答