Created
February 28, 2012 02:30
-
-
Save tommeier/1928769 to your computer and use it in GitHub Desktop.
Resque initializer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Why use RAILS_ROOT and RAILS_ENV? Because this way we can tell our Sinatra app about the config file: | |
# $ RAILS_ENV=production resque-web rails_root/config/initializers/resque.rb | |
require 'resque' | |
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..' | |
rails_env = ENV['RAILS_ENV'] || 'development' | |
resque_config = YAML.load_file(rails_root + '/config/resque.yml') | |
Resque.redis = resque_config[rails_env] | |
#Fire any resque errors to our airbrake configuration | |
require 'resque/failure/airbrake' | |
require 'resque/failure/multiple' | |
require 'resque/failure/redis' | |
Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Airbrake] | |
Resque::Failure.backend = Resque::Failure::Multiple |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment