Getting Heroku's config vars to work in node.js

I have a node app that has a line like this:

var ip = process.env.IP || 'http://localhost';

I am using it with passport-facebook node package to define the callback from Facebook authentication:

passport.use(new FacebookStrategy({
callbackURL: ip + ":" + port + "/auth/facebook/callback"
  function(accessToken, refreshToken, profile, done) {
    // asynchronous verification, for effect...
    process.nextTick(function () {
      return done(null, profile);

It seems that Heroku doesn't know process.env.IP so I went ahead and defined a config var in Heroku:

heroku config:add process.env.IP=

Debugging the server I see that ip is not what I want but it's http://localhost same as I defined as the fallback in the first line of code.

How do I get node to read the config var correctly from heroku ?


You want to use heroku config:set IP=; it defines an environment variable called IP, which you access in Node.js via process.env.IP. See Setting up config vars for a deployed application for more information.

Need Your Help

Providing custom value serialization for enums via JAXB

java xml enums xml-serialization jaxb

For a project I'm working on, we have a lot of enums in use. The model object itself is composed from a lot of tiny classes; this model we then serialize to our DB as XML via JAXB. Now, we want to be

simplest way to check for just spaces in ruby

ruby conditional testing spaces

So I know in ruby that x.nil? will test if x is null.