randombits
randombits

Reputation: 48490

Strategy for live config changes with Rails

I am interested in some smart ways to handle "hot" config changes for a production Ruby on Rails application. A lot of the time, we want certain features enabled or disabled in our application depending on what's going on. This means disabling some asynchronous workers where we have horrible practices such as going into the code and uncommenting a return line at the top of the job. Instead, I'd like to be able to have an on/off switch that doesn't require making a commit to our git repository, thus cluttering version history and making an unecessary push. What are some tools/strategies available in order to be able to enable/disable certain features without making live code changes in Ruby on Rails?

Upvotes: 0

Views: 92

Answers (1)

Martin
Martin

Reputation: 7723

What you want looks like a feature toggle (enabling/disabling "features" at runtime). You could build a system like that yourself... or use rollout which is a ruby gem that allows you to use code like:

if rollout.active?(:chat, User.first)
# ...

You can then either toggle those using the console, or even create a small admin page if this is a regular task.

Upvotes: 2

Related Questions