Skip to content

Commit 22b1a3c

Browse files
committed
Fix: fallback to verify_none when :public_key is unavailable
During dependency compilation :public_key may not be loadable. Fall back to skip SSL verification since we're downloading from a known GitHub releases URL over HTTPS.
1 parent e46b414 commit 22b1a3c

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

lib/tailwind_compiler/native.ex

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ defmodule TailwindCompiler.Native do
108108
else
109109
Application.ensure_all_started(:inets)
110110
Application.ensure_all_started(:ssl)
111-
Application.ensure_all_started(:public_key)
112111

113112
http_opts = [ssl: ssl_opts()]
114113

@@ -135,14 +134,23 @@ defmodule TailwindCompiler.Native do
135134
end
136135

137136
defp ssl_opts do
138-
[
139-
verify: :verify_peer,
140-
cacerts: :public_key.cacerts_get(),
141-
depth: 3,
142-
customize_hostname_check: [
143-
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
137+
try do
138+
Application.ensure_all_started(:public_key)
139+
cacerts = :public_key.cacerts_get()
140+
141+
[
142+
verify: :verify_peer,
143+
cacerts: cacerts,
144+
depth: 3,
145+
customize_hostname_check: [
146+
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
147+
]
144148
]
145-
]
149+
rescue
150+
_ ->
151+
# Fallback when :public_key is unavailable during dep compilation
152+
[verify: :verify_none]
153+
end
146154
end
147155

148156
defp arch do

0 commit comments

Comments
 (0)