yettings icon indicating copy to clipboard operation
yettings copied to clipboard

Make yettings load before initializers?

Open dpehrson opened this issue 12 years ago • 1 comments

Is it possible to make yettings load before initializers so that their values may be used in there?

I attempted to fork the repo and change the config.before_configuration to config.before_initialize but it didn't work, which may very well just be because I am not familiar with Railties.

Is this something that would be doable?

My use case is that I want to put the api keys used by devise's devise.rb initializer into a yettings.yml.

dpehrson avatar Apr 22 '12 22:04 dpehrson

If you're still working off a forked version, instead of doing the config.before_configuration, you can do something like:

initializer "whatevever_you_want_to_call_your_initializer", :before => "name_of_the_initializer_where_you_want_to_use_yettings" do
  Yettings.setup!
end

Off the top of my head, I can't think of a good way of adding this into the gem in a reusable way, definitely worth thinking about though. Would be a good feature. You can check out this blogpost for more info on the rails initialization process.

AdamFerguson avatar May 10 '12 19:05 AdamFerguson