jackbpaiva

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

NobbZ

I’m not only speaking about releases, as far as I understand the “old” way to do configuration has been deprecated:

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

hauleth

It will probably still not change much as some of the release configuration must be done before startup.

Where Next?

Popular in Questions Top

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130579 1222
New
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement