Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rake figaro:heroku configures Heroku incongruently with RAILS_ENV #35

Closed
MarkDBlackwell opened this issue Feb 27, 2013 · 6 comments
Closed

Comments

@MarkDBlackwell
Copy link

bundle exec rake figaro:heroku configures Heroku improperly with development environment values, though config/application.yml is set up exactly as prescribed:

HELLO: world
development:
  HELLO: developers
production:
  HELLO: users

I am aware that README suggests setting RAILS_ENV.

Already, Heroku's RAILS_ENV is set correctly (to 'production'), so this value should be accessible:

$ heroku run rails console
> ENV['RAILS_ENV']
=> "production"

Oddly, bundle exec rake figaro:heroku works correctly, after doing heroku config:set RAILS_ENV=production.

Even without that, doing bundle exec rake figaro:heroku RAILS_ENV=production instead will also work.

But IMO these ways aren't as good, and shouldn't be necessary.

@akshatpradhan
Copy link

I agree with this, or at least lets update the Readme. This was a serious pain in the ass to figure out and the solution was so simple.

@MarkDBlackwell do you want to at least update the Readme and send a pull request to @laserlemon ?

@akshatpradhan
Copy link

"Additionally, if RAILS_ENV is configured on your Heroku server, Figaro will use that environment automatically in determining your proper configuration."

This wasn't obvious at all =/. It's a cool gem otherwise.

@MarkDBlackwell
Copy link
Author

Issue #14 gives rake figaro:heroku RAILS_ENV={environment} a different analysis.

Ideally (as a best practice), perhaps Heroku should give each instance the capability to differ (internally) in its value for RAILS_ENV. However, I guess it's better (because simpler) if they don't.

@laserlemon
Copy link
Owner

What I'm seeing as the problem is that although Heroku seems to set RAILS_ENV and RACK_ENV (and you can demonstrate that in a remote console), you can't seem to access those values programmatically using heroku config:get, which is what the rake task uses. They come back blank by default. I have no idea why, but can look into it when I have time. But that's why it's defaulting to development.

@MarkDBlackwell
Copy link
Author

To access Heroku's internal $RAILS_ENV environment variable, the rake task can do heroku run "echo \$RAILS_ENV".

@laserlemon
Copy link
Owner

Solved by version 0.6.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants