From e39936a71b4799b97ed4e85fb8f9169c34d0594f Mon Sep 17 00:00:00 2001 From: David Cristofaro Date: Tue, 18 Apr 2023 20:34:58 +1000 Subject: [PATCH] Add HTTP Basic authentication --- config.ru | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config.ru b/config.ru index 7031d8d..7268836 100644 --- a/config.ru +++ b/config.ru @@ -3,6 +3,12 @@ require 'net/http' use Rack::Static, :root => 'public' +use Rack::Auth::Basic do |username, password| + ENV['HTTP_BASIC_AUTH_PASSWORD'].present? && + username == 'user' && + password == ENV['HTTP_BASIC_AUTH_PASSWORD'] +end + app = lambda do |env| request_uri = env['REQUEST_URI']