Elixir + Phoenix: System.get_env("my_var") is not working

I have a config in my config/runtime.exs

config :h1bjobs, H1bjobs.ElasticsearchCluster,
  url: System.get_env("ELASTICSEARCH_URL"),
  ...

However, every time I try to deploy, my app crashes and I see this in my logs:

2024-01-16T23:34:55.234 app[18570e5b4551e8] ewr [info] 23:34:55.233 [notice] Application h1bjobs exited: H1bjobs.Application.start(:normal, []) returned an error: shutdown: failed to start child: H1bjobs.ElasticsearchCluster

2024-01-16T23:34:55.234 app[18570e5b4551e8] ewr [info] ** (EXIT) %{url: [{"must be valid", [validation: :by]}]}

I have verified that my secret is set on fly.io:

h1bjobs/server - (main) $ fly secrets list
NAME                    DIGEST                  CREATED AT
...
ELASTICSEARCH_URL       1180e3e134db7d45        26m47s ago

How can I properly refer to my env var?

Try running fly secrets deploy as the secret may be staged but not deployed?
Reference: Secrets and Fly Apps ยท Fly Docs

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.