Skip to content

Instantly share code, notes, and snippets.

@scharfie
Created January 7, 2012 12:01
Show Gist options
  • Save scharfie/1574577 to your computer and use it in GitHub Desktop.
Save scharfie/1574577 to your computer and use it in GitHub Desktop.
password-protect staging server
# config/environments/staging.rb
# Credit: http://olemortenamundsen.wordpress.com/2011/04/05/ruby-secure-staging-environment-of-your-public-app-from-users-and-bots/
MyApp::Application.configure do
config.middleware.insert_after(::Rack::Lock, "::Rack::Auth::Basic", "Staging") do |username, password|
[username, password] == ['username', 'password']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment