Skip to content

Instantly share code, notes, and snippets.

@basti
Created May 28, 2013 07:07
Show Gist options
  • Save basti/5660977 to your computer and use it in GitHub Desktop.
Save basti/5660977 to your computer and use it in GitHub Desktop.
Simple username/password protect for whole app.
if ENV['AUTH_USERNAME'].present? && ENV['AUTH_PASSWORD'].present?
config.middleware.insert_after(::Rack::Lock, "::Rack::Auth::Basic", "Staging") do |user, pass|
[user, pass] == [ENV['AUTH_USERNAME'], ENV['AUTH_PASSWORD']]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment