I was able to achieve that by running mix app.config
first.
mix app.config
Loads and configures all registered apps.
This is done by loadingconfig/runtime.exs
if one exists.
So to see it works you could try running them like:
mix do app.config, something
And to make your task running it automatically - you could call it as a first thing to do in run/1
function
def run(_args) do
Mix.Task.run("app.config")
IO.inspect(Application.get_env(:test, :port))
...