These steps assume that you already have a working app on OpenShift. If you need help, you can get started here!
rhc app show YOUR_APP_NAME
ssh YOUR_APP_SSH_URL
echo "export SECRET_PASS=12345678910" >> ~/app-root/data/.bash_profile
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 in node.js via process.env.*
Specifically, the above example should make process.env.SECRET_PASS
available in your code.
PHP users should be able to access the same variable as getenv('SECRET_PASS')
. If you are not using node.js, then the name of the action hook start script (in line 2-3 of step 4) will be different, and will need to be adjusted accordingly.