Search code examples
rubysinatraopenshiftopenshift-client-tools

Environment variables not showing up on Openshift ruby 2.0


I've been playing around with Open Shift and tried to pass an environment variable. First, I set it with rhc env set TEST=foo -a myApp. Then I ensured it was there with rhc env list -a myAPP, and it was.

Nest, in my app, I put Test variable = <%= ENV['TEST'] %>, but nothing shows up after I deploy. Is there something I'm missing here? Running ruby 2.0 cartridge with Sinatra, fwiw.


Solution

  • Try doing a "stop" and "start" on your application (not a restart) and see if they show up, i believe the ruby cartridge just touches "tmp/restart.txt" in your rails application/passenger to restart it, which does not reload apache and pick up new environment variables (would probably do something similar with rack based applications that are not rails also)

    rhc app <appname> stop
    rhc app <appname> start