How do I see the ENV vars in a Rails app?
Assuming the staging environment, as your example points to. You'll want to load the console by prepending the RAILS_ENV environment variable to the rails console
command.
RAILS_ENV=staging rails console
That should get you in. Once you're in, you can just access the ENV
variable directly.
2.2.2 (main):0 > ENV
And that will dump out the environment variables for you. Note, your prompt may look different. If you want to access a specific value, such as the database password, you can:
2.2.2 (main):0 > ENV['STAGE_DATABASE_PASSWORD']
Within your app directory, simply launch the Rails Console:
rails c
Then at the prompt:
ENV
This will list all loaded environmental variables for whichever environment you last exported.
Sorry, after posting this, I realized that the author had already tried to use rails console with errors...but I am fairly sure this should always work. You can't ask for printenv or env within the console, you must use all caps "ENV"