Move NoopAdapter to Domain app (#1756)

Workaround for this:

https://github.com/elixir-lang/elixir/issues/12777
This commit is contained in:
Jamil
2023-07-10 15:00:29 -07:00
committed by GitHub
parent d27da5ee3d
commit 1ffd08f2db
3 changed files with 12 additions and 2 deletions

View File

@@ -1,8 +1,12 @@
defmodule Web.Mailer.NoopAdapter do
defmodule Domain.Mailer.NoopAdapter do
@moduledoc """
When mailer is not configure, use noop adapter as a drop-in replacement
so that we don't have to add conditional logic to every single call to
`Web.Mailer.deliver/2`.
# XXX: Having this module in the Domain app is a workaround for the following issue:
# https://github.com/elixir-lang/elixir/issues/12777
# Move this module back to the Web app once this is fixed.
"""
use Swoosh.Adapter
require Logger

View File

@@ -77,6 +77,12 @@ defmodule Domain.MixProject do
{:opentelemetry_ecto, "~> 1.1"},
{:opentelemetry_finch, "~> 0.2.0"},
# Mailer deps
# XXX: This is a workaround for the following issue:
# https://github.com/elixir-lang/elixir/issues/12777
# Remove Swoosh from Domain once this is fixed.
{:phoenix_swoosh, "~> 1.0"},
# Test and dev deps
{:bypass, "~> 2.1", only: :test},
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},

View File

@@ -169,7 +169,7 @@ config :posthog,
api_key: "phc_ubuPhiqqjMdedpmbWpG2Ak3axqv5eMVhFDNBaXl9UZK"
config :web, Web.Mailer,
adapter: Web.Mailer.NoopAdapter,
adapter: Domain.Mailer.NoopAdapter,
from_email: "test@firez.one"
# TODO: actually copy fonts here, otherwise:application