Created
January 7, 2012 12:01
-
-
Save scharfie/1574577 to your computer and use it in GitHub Desktop.
password-protect staging server
This file contains hidden or 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
# 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