Closed jablan closed 6 years ago
Sounds about right. 😅 This is likely a better question to ask the Elixir and/or Plug maintainers, since it's not specific to RemoteIp
. A quick search for "elixir environment variables" leads to a blog post that seems to discuss this very issue: http://blog.plataformatec.com.br/2016/05/how-to-config-environment-variables-with-elixir-and-exrm/ Check out the comments, too: people appear to have written generic libraries to try to solve the problem, like flasked.
More specifically, I have technically seen this problem dodged by regenerating the list of IPs statically so that it's available at compile time. plug_cloudflare includes a Mix task that downloads the list of IP addresses into a static file, which can then be compiled into the code. But it's sort of hacky, and probably means adjusting your release process.
Hope that helps!
Hi, as a proxy list I need to pass information coming from an environment variable, but they are present only in the runtime environment. By the nature of Phoenix plugs,
init
is called only in compile time.Do you have an idea how would I solve this issue?