diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 6d43c68..5a9d515 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -59,6 +59,11 @@ # Enable threaded mode # config.threadsafe! + # Secure staging enviroment + config.middleware.insert_before 'Rack::Cache', 'Rack::Auth::Digest::MD5', 'stopwat.ch staging', SecureRandom.base64 do |user| + user == ENV['STAGING_HTTP_AUTH_USER'] && ENV['STAGING_HTTP_AUTH_PSWD'] + end + # Add Faye has middleware redis_config = ENV['REDISTOGO_URL'].match(/redis:\/\/.+?:(?.+?)@(?.+?):(?\d+)/) config.middleware.insert_before 'Rack::Cache', 'Faye::RackAdapter',