daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Jan 25th, 2016 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'resque'
  2. require 'resque/server'
  3.  
  4. uri = URI.parse(APP_CONFIG['redis_to_go_url'])
  5. Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
  6.  
  7. # Load all jobs at /app/jobs
  8. Dir["#{Rails.root}/app/jobs/*.rb"].each { |file| require file }
  9.    
  10. mount Resque::Server.new, :at => '/resque'
  11.    
  12. require File.dirname(__FILE__) + '/config/environment'
  13. require 'resque/server'
  14.  
  15. Resque::Server.class_eval do
  16.  
  17.   use Rack::Auth::Basic do |email, password|
  18.     user = User.authenticate( email, password )
  19.     user && user.admin?
  20.   end
  21.  
  22. end
  23.  
  24. app = Rack::Builder.new {
  25.   use Rails::Rack::Static
  26.  
  27.   map "/resque" do
  28.     run Resque::Server
  29.   end
  30.  
  31.   map "/" do
  32.     run ActionController::Dispatcher.new
  33.   end
  34. }.to_app
  35.  
  36. run app
  37.    
  38. Resque::Server.class_eval do
  39.  
  40.   use Rack::Auth::Basic do |email, password|
  41.     user = User.authenticate( email, password )
  42.     user && user.admin?
  43.   end
  44.  
  45. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top