#Here is how I keep my secrets out of my source code when working with OpenShift
-
find your app's ssh address:
rhc app show YOUR_APP_NAME
-
ssh into your gear to set your environment variables:
ssh YOUR_APPS_SSH_URL
-
add your environment variables to your ~/app-root/data/.bash_profile
echo "export SECRET_PASS=12345678910" >> ~/app-root/data/.bash_profile
-
make sure that your .bash_profile is sourced during your app's start up:
cd YOUR_LOCAL_REPO
echo "source ~/app-root/data/.bash_profile" >> .openshift/action_hooks/pre_start_nodejs-0.6
git add .openshift/action_hooks/pre_start_nodejs-0.6
git commit -m 'importing bash profile during app init'
git push
Once you have completed these steps, you should be able to reference these variables via process.env.* The above example should make process.env.SECRET_PASS available in your code.