hauleth

hauleth

Shared config instead of per-app config in Umbrella applications

Currently default Umbrella applications contains

import_config "apps/*/config/config.exs

In their root configuration file. My general question is why though? IMHO it provides only confusion and can lead to ugly bugs when order in which the “nested” configuration files will be imported will change (I haven’t seen any order guarantees in documentation of either import_config/1, Path.wildcard/1, nor filelib:wildcard/1). What I am proposing instead is that we should encourage having only one config/ directory in root of the umbrella.

Additionally for configuring current application we should encourage users to use :env option of application specification instead of global configuration file.

Most Liked

nsweeting

nsweeting

As mentioned above, you eliminate the need for all “global configuration”, which IMO, is less than ideal (ignoring the fact that mix config is global anyways :stuck_out_tongue:), by simply creating apps for those “global requirements” - ie. logging and metrics. My umbrella apps usually include both a logging and metrics app. These apps will do all the setup required for their domain. Any app that requires logging or metrics simply has to add [{:logging, in_umbrella: true}, {:metrics, in_umbrella: true}] to their deps. If your requirements for logging or metrics ever expand - you have an easy point in which to work on it. This becomes more pronounced if you ever need to add “sinks” for either logging or metrics that require runtime config. Having an app for these makes it very clear where that code would go.

Keeps things focused. Works for me. Might not for others…

LostKobrakai

LostKobrakai

The only upside I see to split up config is that it’s clearer which parts of it are shared and which parts are only needed by a single application. One place where this is beneficial is when you want to move apps into/out of the umbrella. But otherwise I’d agree it’s prone to cause pain, as when running the umbrella there can only ever be one application environment.

hubertlepicki

hubertlepicki

I do precise opposite. In apps/*/config.exs I only have:

use Mix.Config
import_config Path.join("..", "..", "..", "config", "config.exs")

and only have one instance of dev.exs, test.exs and prod.exs per whole project, instead of splitting this among multiple files.

It’s easier when the project becomes big to have the configuration consolidated in my opinion.

Where Next?

Popular in Discussions Top

arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New
vans163
So useless benchmarks aside, Its possible to write a webserver that can serve 300k requests per second (perhaps more with optimizations)....
New
WildYorkies
It seems that the more I read, the more I find Elixir users speaking about all the ways that Elixir is not good for x, y, and z use cases...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
chuck
Let me start by stating an assumption: Phoenix is a great approach to building REST APIs. There are many reasons for this, but I will ass...
New
PragTob
Hey everyone, this has been on my mind for some time and I’d love your input on it! TLDR: I feel like maps are superioer for storing and...
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
100phlecs
Are there any downsides, like perf issues, to putting all functional components in CoreComponents as long as you prefix it with the conte...
New
Markusxmr
Since Drab has been developed for a while in the open, introducing the Liveview functionality in a way it happend appears to undermine th...
New

Other popular topics Top

New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 43487 311
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52673 488
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
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
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement