From 0481b0f6f1ac18d1efc03db9bb92b44458a9cc8f Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Thu, 7 May 2026 20:53:18 +0200 Subject: [PATCH] Allow Capybara test server IP in HostAuthorization --- config/application.rb.dist | 4 ++-- config/environments/test.rb | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/application.rb.dist b/config/application.rb.dist index 9270b0c..9a57469 100644 --- a/config/application.rb.dist +++ b/config/application.rb.dist @@ -47,13 +47,13 @@ module FixinMe # SETUP: Below settings need to be updated on a per-installation basis. # # Set host to be used by links generated in mailer templates. - config.action_mailer.default_url_options = {host: 'localhost', :protocol => 'https'} + config.action_mailer.default_url_options = {host: 'localhost', protocol: 'https'} # https://guides.rubyonrails.org/configuring.html#config-action-mailer-delivery-method config.action_mailer.delivery_method = :sendmail # List of hosts this app is available at. # https://guides.rubyonrails.org/configuring.html#actiondispatch-hostauthorization - config.hosts += ['localhost', IPAddr.new('1.2.3.4/32'), 'example.com'] + config.hosts |= ['localhost'] # Email address of admin account config.admin = 'admin@localhost' diff --git a/config/environments/test.rb b/config/environments/test.rb index f761585..d99e62d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -32,7 +32,8 @@ Rails.application.configure do config.action_mailer.delivery_method = :test # Set host to be used by links generated in mailer templates. - config.action_mailer.default_url_options = { host: 'localhost', protocol: 'http' } + config.action_mailer.default_url_options = {host: Capybara.server_host, + protocol: 'http'} # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr @@ -46,5 +47,8 @@ Rails.application.configure do # Raise error when a before_action's only/except options reference missing actions. config.action_controller.raise_on_missing_callback_actions = true + # Allow Capybara application server IP + config.hosts |= [IPAddr.new(Capybara.server_host)] + config.log_level = :info end