From 0ea2addc91247a2dc5a909c59614e74443957b23 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 15 Jan 2026 16:06:01 -0600 Subject: [PATCH] Fix Bandit configuration and user settings HTML test Bandit 1.10.1 does not support read_timeout/write_timeout in http_1_options or stream_idle_timeout in http_2_options. These invalid options caused the application to crash on startup with 'Unsupported key(s) in http_1_options'. Moved read_timeout to thousand_island_options where it belongs, and removed the unsupported write_timeout and stream_idle_timeout options. Also fixed UserSettingsHTMLTest to include the missing mobile_sessions assign that is required by the edit.html.heex template. --- config/runtime.exs | 15 ++++----------- .../controllers/user_settings_html_test.exs | 6 ++++-- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index d308bbc9..2b0a91da 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -135,17 +135,10 @@ if config_env() == :prod do # See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0 # for details about using IPv6 vs IPv4 and loopback vs public addresses. ip: {0, 0, 0, 0, 0, 0, 0, 0}, - # Bandit HTTP/1 configuration - http_1_options: [ - # Timeout for reading request headers and body (30 seconds) - read_timeout: 30_000, - # Timeout for sending response (30 seconds) - write_timeout: 30_000 - ], - # Bandit HTTP/2 configuration - http_2_options: [ - # Timeout for stream idle (60 seconds) - stream_idle_timeout: 60_000 + # Bandit uses ThousandIsland for connection management + # Timeout for reading client data before closing the connection (30 seconds) + thousand_island_options: [ + read_timeout: 30_000 ] ], secret_key_base: secret_key_base diff --git a/test/towerops_web/controllers/user_settings_html_test.exs b/test/towerops_web/controllers/user_settings_html_test.exs index d3b95ac8..f9123aa9 100644 --- a/test/towerops_web/controllers/user_settings_html_test.exs +++ b/test/towerops_web/controllers/user_settings_html_test.exs @@ -17,7 +17,8 @@ defmodule ToweropsWeb.UserSettingsHTMLTest do email_changeset: email_changeset, password_changeset: password_changeset, credentials: [], - can_register_passkey: true + can_register_passkey: true, + mobile_sessions: [] ) assert html =~ "Account Settings" @@ -38,7 +39,8 @@ defmodule ToweropsWeb.UserSettingsHTMLTest do email_changeset: email_changeset, password_changeset: password_changeset, credentials: [], - can_register_passkey: false + can_register_passkey: false, + mobile_sessions: [] ) assert html =~ "Please confirm your email address before registering a passkey"