Where is ECTO_IPV6 set?

Hey all,

I’m trying to get a simple Phoenix app up and running on Fly.io and I ran into a problem I’d like to understand better.

I’m trying to connect to an external DB and I figured it doesn’t support IPV6 connections. That said, I tried setting ENV ECTO_IPV6 false in my Dockerfile but I still got my Repo configured with IPV6. I then debugged the code by adding a simple:

IO.inspect System.get_env("ECTO_IPV6"), label: "ECTO_IPV6: "

and this keeps saying the ECTO_IPV6 is "true" even though the env var is set in my Dockerfile. I’m might be missing something, but how can I set this ECTO_IPV6 to false?

Btw, I tested the app by hard-coding the socket options and the connection worked as expected.

Thanks,
Angelo

I had the exact same experience where removing ECTO_IPV6 from my Dockerfile had no effect. My solution was the rename the ECTO_ prefix to DATABASE_ and set that as an ENV var.

I actually found where the env var is set.

Once you launch your app with fly launch, a new file is created here rel/env.sh.eex and that’s where the ECTO_IPV6 is set.

I haven’t found anything in the docs where they mentioned this file, but maybe I should’ve spent a bit more time reading. Who knows!

Anyhow, I hope that helps you too.