Setting up redis ENV variables -- Node.js on Openshift

I'm migrating from Heroku to Openshift since my app employs socket.io heavily. I seem to have hooked up redis correctly but just want to make sure.

When I enter this:

 rhc cartridge-status redis -a myapp

I get this:

Using smarterclayton-redis-2.6 (Redis) for 'redis'

RESULT:

Redis is running
  master (receives writes), mode sharded
  Connect to: xxhostnumberxx-myapp.rhcloud.com:xxportnumberxx password:xxsomepasswordxx

I then set ENV variables like so:

rhc set-env OPENSHIFT_REDIS_HOST=xxhostnumberxx-myapp.rhcloud.com -a myapp
rhc set-env OPENSHIFT_REDIS_PORT=com:xxportnumberxx -a myapp
rhc set-env REDIS_PASSWORD=password:xxsomepasswordxx -a myapp

And then in my app.js I have:

var redis;

// Openshift redis connection
if (process.env.OPENSHIFT_REDIS_HOST) {

    var redisHost = process.env.OPENSHIFT_REDIS_HOST;
    var redisPort = process.env.OPENSHIFT_REDIS_PORT;
    var redisPass = process.env.REDIS_PASSWORD;

    redis = require('redis').createClient(redisPort, redisHost);
    redis.auth(redisPass);
} 
// Localhost
else {
    redis = require('redis').createClient();
}

It seems to be working as my req.session is undefined error is gone (I'm using redis for session management).

I just want to make sure that I'm doing this right. Are the variables I set the correct ones and not going to change? Or is there a way to set them dynamically?

Yea it looks good to me. You're setting the environment variables correctly with rhc set-env and since you're using the hostname and not the IP, it shouldn't change.