figaro: Figaro not loading config in application.rb for Rails v4.2

Just updated to Rails v4.2.0, and noticed that Figaro is no longer setting the environment in application.rb as it used to in Rails v4.1:

module MyApp
  class Application < Rails::Application
     ENV['SET_BY_FIGARO'] # => nil
     Figaro.env.SET_BY_FIGARO # => nil
  end
end

Everything still works from an initializer though… although I do need access to the values sooner to use in the config files.

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Reactions: 2
  • Comments: 17 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Just wanted to confirm that I had the same issue. I fixed it by adding an initializer with Figaro.load.

One problem with this approach is that values are not updated after modifying config/application.yml. In order for the updates to be recognized I had to stop spring by running spring stop.

omg, just wasted an hour of my life debugging this. wtf do we need to run spring stop for our variables to update.

bin/spring stop

this is awesome

I’ll give it a go. I managed to fix it by adding Figaro.load to the top of the class Application... bit.