Skip to content

Commit 2174cc0

Browse files
committed
Allow sni_certs / sni_fun in place of key / cert configuration
1 parent c8973bd commit 2174cc0

File tree

1 file changed

+10
-4
lines changed
  • lib/thousand_island/transports

1 file changed

+10
-4
lines changed

lib/thousand_island/transports/ssl.ex

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,18 @@ defmodule ThousandIsland.Transports.SSL do
6161

6262
resolved_options = @hardcoded_options ++ user_options ++ default_options
6363

64-
if not Enum.any?([:keyfile, :key], &:proplists.is_defined(&1, resolved_options)) do
65-
raise "transport_options must include one of keyfile or key"
64+
if not Enum.any?(
65+
[:keyfile, :key, :sni_hosts, :sni_fun],
66+
&:proplists.is_defined(&1, resolved_options)
67+
) do
68+
raise "transport_options must include one of keyfile, key, sni_hosts or sni_fun"
6669
end
6770

68-
if not Enum.any?([:certfile, :cert], &:proplists.is_defined(&1, resolved_options)) do
69-
raise "transport_options must include one of certfile or cert"
71+
if not Enum.any?(
72+
[:certfile, :cert, :sni_hosts, :sni_fun],
73+
&:proplists.is_defined(&1, resolved_options)
74+
) do
75+
raise "transport_options must include one of certfile, cert, sni_hosts or sni_fun"
7076
end
7177

7278
:ssl.listen(port, resolved_options)

0 commit comments

Comments
 (0)