I am building a dockerized phoenix application to create an api, nevertheless, each time I want to use an environmental variable looks like elixir still using the data (which is
nil) that was injected in my prod.secret once I build the image. The fun part comes when I try asking for the variable directly using
iex -S mix and typing
Application.get_env(:application, SomeModule)[:config_key] it returns the value of my environmental variable.
I have faced the same issue before when we were using aws elastic beanstalk, and I have always resolved the issue re-deploying the same app version. Nowadays we are using other tool called kontena.io and I am facing the same issue, do you guys have any ideas?
My configuration file basically looks like this:
config :application, SomeModule, config_key: System.get_env("VARIABLE_NAME")
and I use it in my code like that:
defmodule SomeModule do .... #This is nil when I run the code in production @variable Application.get_env(:application, SomeModule)[:config_key] .... end
Most of the kontena commands I have already used are listed here just in case you’re curious about them.
Thank you in advance.