jackbpaiva
Add configs dynamic
Good morning people.
I am having a question about how I could do a function that would do an external access and then I would add this setting in the config.exs file.
config.exs
config :myapp_web, MyappWeb.Endpoint,
test: [host: MyappWeb.External.test()]
external.ex
defmodule MyappWeb.External do
def test do
response = "localhost"
response
end
end
Not found MyappWeb.External.test.
Thanks.
Marked As Solved
NobbZ
I’m not only speaking about releases, as far as I understand the “old” way to do configuration has been deprecated:
https://hexdocs.pm/mix/1.9.0/Mix.Config.html
This module is deprecated. Use Config and Config.Reader instead.
While there is now Config available.
But yeah, from a quick glance, usage of those modules pretty much the same, and also its documentation says, that mix will evaluate the config on each run, meaning before actual compiling/loading/running the application takes place
Also Liked
hauleth
It will probably still not change much as some of the release configuration must be done before startup.







