hiett commited on
Commit
a664070
1 Parent(s): 91ddbef

add ipv6 support via env var

Browse files
Files changed (1) hide show
  1. lib/srh.ex +14 -1
lib/srh.ex CHANGED
@@ -16,7 +16,8 @@ defmodule Srh do
16
  scheme: :http,
17
  plug: Srh.Http.BaseRouter,
18
  options: [
19
- port: port
 
20
  ]
21
  }
22
  ]
@@ -25,4 +26,16 @@ defmodule Srh do
25
 
26
  Supervisor.start_link(children, opts)
27
  end
 
 
 
 
 
 
 
 
 
 
 
 
28
  end
 
16
  scheme: :http,
17
  plug: Srh.Http.BaseRouter,
18
  options: [
19
+ port: port,
20
+ net: check_inet_mode()
21
  ]
22
  }
23
  ]
 
26
 
27
  Supervisor.start_link(children, opts)
28
  end
29
+
30
+ defp check_inet_mode() do
31
+ ipv6 = System.get_env("SRH_IPV6", "false")
32
+ do_check_inet_mode(ipv6)
33
+ end
34
+
35
+ defp do_check_inet_mode("true") do
36
+ IO.puts("Using ipv6.")
37
+ :inet6
38
+ end
39
+
40
+ defp do_check_inet_mode(_), do: :inet
41
  end