harden env handling (#481)
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #481
Co-authored-by: Simon <s.thiessen@local-it.org>
Co-committed-by: Simon <s.thiessen@local-it.org>
This commit is contained in:
Simon 2026-04-08 10:40:22 +02:00 committed by simon
parent bac488b47c
commit c48ac2f432
9 changed files with 207 additions and 55 deletions

View file

@ -100,7 +100,11 @@ defmodule Mv.Mailer do
"""
@spec smtp_config() :: keyword()
def smtp_config do
if Mv.Config.smtp_configured?() and not boot_smtp_configured?() do
# In test we use Swoosh.Adapters.Test; do not override with SMTP opts or emails would not land in the test mailbox.
adapter = Application.get_env(:mv, __MODULE__, []) |> Keyword.get(:adapter)
if Mv.Config.smtp_configured?() and not boot_smtp_configured?() and
adapter != Swoosh.Adapters.Test do
verify_mode =
if Application.get_env(:mv, :smtp_verify_peer, false),
do: :verify_peer,