Can’t I define a variable to be used in different envs when I define the env?
app.configure 'development', () ->
app.use express.errorHandler({dumpExceptions: true, showStack: true})
mongoose.connect 'mongodb://xxx:xxx-db2011@sun.memberd.mongohq.com:10012/xxxx'
test = "ola23"
app.configure 'production', () ->
app.use express.errorHandler()
mongoose.connect 'mongodb://xxx:xxx-db2011@sun.memberd.mongohq.com:10012/xxxx'
test = "ola"
I can define the “mongoose.connect“, why can’t I define test?
That code sets a local variable to that configuration function to a value. I’m sure that works. But how do you need to use that
testvariable?The way you’ve done it here, it simply will go away as soon as this function finishes, you aren’t sending or saving it anywhere. The
mongoose.connectline, does something, it passes in a string to a function that uses that string to do something awesome.test = "ola"only sets a local variable.So without knowing how you want to use
testit’s hard to advise more. But you probably want this instead:Which you can then retrive
"ola"later with: