Compartmentalizing db connections in Umbrella application with new Config behavior

Previously, when in an umbrella application, I made specific apps rely on other database-specific apps in the umbrella. E.g. app A depended on app DB_1, app B depended on app DB_2, and app C depended on both of the DB apps.

Doing this allowed me to run scripts app A while only needing the credentials for a supervised connection to DB_1, etc.

Now, however, since the new Config module makes umbrella app config run at the top level, running scripts related to app A functionality appears to wrap all the Config up at the top level, thus requiring the supervised connection to DB_2 I was previously able to avoid.

The simplest solution to this is (unfortunately) breaking these things out of an umbrella and making them individual apps, thus getting around this shared dependency problem. This will add a lot of development cycles for me, however, and I like that I only have to spin one plate right now.

The other solution is to not use supervisors via Ecto’s config but this seems obviously imprudent.

Am I missing something or are my hands tied with being able to compartmentalize db connection from now on with how config in umbrellas works?

Either you have config at each child or at root level - you app always see the same, all configuration. (config_path: "../../config/config.exs" in child app mix.exs) - and moving config from individual app to umbrella root does not change any behavior, as Elixir v1.9 released says.

Furthermore, mix new --umbrella will no longer generate a configuration for each child app, instead all configuration should be declared in the umbrella root. That’s how it has always behaved, we are now making it explicit.

How do you run “scripts”? If you use mix, then just go to the child application and run there - or you can use mix cmd