Skip to content

Instantly share code, notes, and snippets.

@ahawkins
Created December 11, 2010 05:27
Show Gist options
  • Save ahawkins/737173 to your computer and use it in GitHub Desktop.
Save ahawkins/737173 to your computer and use it in GitHub Desktop.
resque web server + rack + rails 2 + bundler
#!/usr/bin/env ruby
require 'logger'
require 'rubygems'
require 'config/environment'
require 'resque/server'
# Set the RESQUECONFIG env variable if you've a `resque.rb` or similar
# config file you want loaded on boot.
load ::File.expand_path(File.join(File.dirname(__FILE__), "config", "initializers", "resque.rb"))
# Set the AUTH env variable to your basic auth password to protect Resque.
AUTH_PASSWORD = ENV['AUTH']
if AUTH_PASSWORD
Resque::Server.use Rack::Auth::Basic do |username, password|
password == AUTH_PASSWORD
end
end
run Rack::URLMap.new \
"/" => ActionController::Dispatcher.new,
"/resque" => Resque::Server.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment