Add RailsPulse monitoring tool with basic HTTP authentication

This commit is contained in:
Eugene Burmakin 2025-12-28 17:49:34 +01:00
parent be5307f963
commit 1164bc8695

View file

@ -139,14 +139,14 @@ RailsPulse.configure do |config|
config.authentication_enabled = true config.authentication_enabled = true
# Where to redirect unauthorized users # Where to redirect unauthorized users
# config.authentication_redirect_path = "/" config.authentication_redirect_path = '/'
# Custom authentication method - choose one of the examples below: # Custom authentication method - choose one of the examples below:
# Example 1: Devise with admin role check # Example 1: Devise with admin role check
config.authentication_method = proc { # config.authentication_method = proc {
redirect_to main_app.root_path, alert: 'Access denied' unless user_signed_in? && current_user.admin? # redirect_to main_app.root_path, alert: 'Access denied' unless user_signed_in? && current_user.admin?
} # }
# Example 2: Custom session-based authentication # Example 2: Custom session-based authentication
# config.authentication_method = proc { # config.authentication_method = proc {
@ -161,11 +161,11 @@ RailsPulse.configure do |config|
# } # }
# Example 4: Basic HTTP authentication # Example 4: Basic HTTP authentication
# config.authentication_method = proc { config.authentication_method = proc {
# authenticate_or_request_with_http_basic do |username, password| authenticate_or_request_with_http_basic do |username, password|
# username == ENV['RAILS_PULSE_USERNAME'] && password == ENV['RAILS_PULSE_PASSWORD'] username == ENV['RAILS_PULSE_USERNAME'] && password == ENV['RAILS_PULSE_PASSWORD']
# end end
# } }
# Example 5: Custom authorization check # Example 5: Custom authorization check
# config.authentication_method = proc { # config.authentication_method = proc {