Skip to content
This repository
Browse code

add http_auth protection with optional environment variables

code from @wuputah
  • Loading branch information...
commit 8afe4e58bd92ba8dbeb7b23b5d165702081d0cc6 1 parent 39ab550
authored August 05, 2011 antekpiechnik committed February 04, 2012

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. 7  config.ru
7  config.ru
... ...
@@ -1,4 +1,11 @@
1 1
 # This file is used by Rack-based servers to start the application.
2 2
 
3 3
 require ::File.expand_path('../config/environment',  __FILE__)
  4
+
  5
+if ENV['BIGTUNA_HTTP_AUTH_USERNAME'] && ENV['BIGTUNA_HTTP_AUTH_PASSWORD']
  6
+  use Rack::Auth::Basic, "Restricted Area" do |username, password|
  7
+    [username, password] == [ENV['BIGTUNA_HTTP_AUTH_USERNAME'], ENV['BIGTUNA_HTTP_AUTH_PASSWORD']]
  8
+  end
  9
+end
  10
+
4 11
 run BigTuna::Application

0 notes on commit 8afe4e5

Please sign in to comment.
Something went wrong with that request. Please try again.