Permalink
Browse files

add http_auth protection with optional environment variables

code from @wuputah
  • Loading branch information...
1 parent 39ab550 commit 8afe4e58bd92ba8dbeb7b23b5d165702081d0cc6 Gabriel Horner committed with antekpiechnik Aug 5, 2011
Showing with 7 additions and 0 deletions.
  1. +7 −0 config.ru
View
@@ -1,4 +1,11 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
+
+if ENV['BIGTUNA_HTTP_AUTH_USERNAME'] && ENV['BIGTUNA_HTTP_AUTH_PASSWORD']
+ use Rack::Auth::Basic, "Restricted Area" do |username, password|
+ [username, password] == [ENV['BIGTUNA_HTTP_AUTH_USERNAME'], ENV['BIGTUNA_HTTP_AUTH_PASSWORD']]
+ end
+end
+
run BigTuna::Application

0 comments on commit 8afe4e5

Please sign in to comment.