Skip to content

Instantly share code, notes, and snippets.

@elle
Last active December 8, 2017 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elle/7e64fd9a33904573c58656e73c431cfc to your computer and use it in GitHub Desktop.
Save elle/7e64fd9a33904573c58656e73c431cfc to your computer and use it in GitHub Desktop.
Using Rack::Auth::Basic
# config/staging.rb
Rails.application.configure do
config.middleware.use "::Rack::Auth::Basic" do |u, p|
[u, p] == [ENV["BASIC_AUTH_USERNAME"], ENV["BASIC_AUTH_PASSWORD"]]
end
end
# .env
BASIC_AUTH_USERNAME = some_value
BASIC_AUTH_PASSWORD = some_password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment