From 9844819b1c5680e9f86f5ba789b76bd42082468f Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Tue, 27 Aug 2024 19:57:42 -0700 Subject: [PATCH] Added option to enable IPv6 in runtime config --- config/runtime.exs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/runtime.exs b/config/runtime.exs index 1a3c0de..f820498 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -66,6 +66,7 @@ if config_env() == :prod do journal_mode = String.to_existing_atom(System.get_env("JOURNAL_MODE", "wal")) # For running PF in a subdirectory via a reverse proxy base_route_path = System.get_env("BASE_ROUTE_PATH", "/") + enable_ipv6 = String.length(System.get_env("ENABLE_IPV6", "")) > 0 config :logger, level: String.to_existing_atom(System.get_env("LOG_LEVEL", "debug")) @@ -120,7 +121,7 @@ if config_env() == :prod do # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access. # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html # for details about using IPv6 vs IPv4 and loopback vs public addresses. - ip: {0, 0, 0, 0}, + ip: if(enable_ipv6, do: {0, 0, 0, 0}, else: {0, 0, 0, 0, 0, 0, 0, 0}), port: String.to_integer(System.get_env("PORT") || "4000") ], url: [path: base_route_path],