Last active
July 28, 2020 16:41
-
-
Save virolea/11d13eb56f908058864b8180cbfc0d3c to your computer and use it in GitHub Desktop.
HTTP Basic Auth for Rack applications - Protect Rails app staging environment with HTTP Basic Auth
This file contains 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
MyApp::Application.configure do | |
# Restrict access with HTTP Basic Auth for staging environment | |
if ENV['STAGING_AUTH'] | |
config.middleware.use Rack::Auth::Basic do |username, password| | |
ENV['STAGING_AUTH'].split(':') == [username, password] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment