Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 11 additions and 1 deletion.
  1. +11 −1 app_prototype/config.ru
View
12 app_prototype/config.ru
@@ -1,8 +1,18 @@
# This file is used by Rack-based servers to start the application.
-require ::File.expand_path('../config/environment', __FILE__)
+require ::File.expand_path('../config/environment', __FILE__)
# Disable buffering for real time logging, see: https://devcenter.heroku.com/articles/logging#writing-to-your-log
$stdout.sync = true
+# Optional Basic Auth - Enabled if BASIC_AUTH_PASSWORD is set. User is optional (any value will be accepted).
+BASIC_AUTH_USER = ENV['BASIC_AUTH_USER']
+BASIC_AUTH_PASSWORD = ENV['BASIC_AUTH_PASSWORD']
+
+if BASIC_AUTH_PASSWORD
+ use Rack::Auth::Basic do |username, password|
+ password == BASIC_AUTH_PASSWORD && (BASIC_AUTH_USER.blank? || username == BASIC_AUTH_USER)
+ end
+end
+
run AppPrototype::Application

No commit comments for this range

Something went wrong with that request. Please try again.