Skip to content

Commit 25baf19

Browse files
committed
Add workaround to silence Premailex SSL errors
Thanks to @jarvisjohnson for this solution: danschultzer/premailex#87 (comment)
1 parent 4f1a3e6 commit 25baf19

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

registrations/lib/registrations/application.ex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ defmodule Registrations.Application do
1313
config: %{metadata: [:file, :line]}
1414
})
1515

16+
set_premailex_ssl_options()
17+
1618
# Without this the GameController filter produces this error: not an already existing atom
1719
specification_concept_hack = String.to_atom("specification.concept")
1820
specification_id_hack = String.to_atom("specification.id")
@@ -51,4 +53,21 @@ defmodule Registrations.Application do
5153
RegistrationsWeb.Endpoint.config_change(changed, removed)
5254
:ok
5355
end
56+
57+
# https://github.com/danschultzer/premailex/issues/87#issuecomment-2635517602
58+
defp set_premailex_ssl_options do
59+
Application.put_env(
60+
:premailex,
61+
:http_adapter,
62+
{Premailex.HTTPAdapter.Httpc,
63+
[
64+
ssl: [
65+
verify: :verify_peer,
66+
cacerts: :public_key.cacerts_get(),
67+
depth: 3,
68+
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)]
69+
]
70+
]}
71+
)
72+
end
5473
end

0 commit comments

Comments
 (0)