I’m following along with the instructions for converting an existing app as I prepare to launch a simple Phoenix app on Gigalixir: https://gigalixir.readthedocs.io/en/latest/main.html#modifying-existing-app
I’ve noticed that the config files do not pick up environment variables as expected:
config :hello, Hello.Repo,
adapter: Ecto.Adapters.Postgres,
# url: "${DATABASE_URL}", # <--- this does not!
url: System.get_env("DATABASE_URL"), # <-- this works!
database: "",
ssl: false,
pool_size: 2 # Free tier db only allows 4 connections. Rolling deploys need pool_size*(n+1) connections.
Then doing a test of the setup via this bash command:
SECRET_KEY_BASE="$(mix phx.gen.secret)" MIX_ENV=prod DATABASE_URL="postgresql://uuuuuu:ppppppp@localhost:5432/hello" PORT=4000 mix phx.server
"${DATABASE_URL}"
does not work. I kept getting errors:
** (Ecto.InvalidURLError) invalid url ${DATABASE_URL}, host is not present
System.get_env("DATABASE_URL")
worked as expected.
Anyone else run into this? And why is this the case?