Best practices: Umbrella app with Multiple Repos

Yes, some abstraction here would be helpful…

Let’s say my umbrella has some apps that require a PostGres Repo and some apps require a MySQL Repo. Instead of the application.ex having something like supervisor(AppOne.Repo, []), I could instead create a couple dedicated apps under the umbrella for PostGres.Repo and MySQL.Repo and then in app_one I could define a config something like:

config :app_one, repo: PostGres.Repo

And then I could reference it in my contexts something like this:

defmodule AppOne.Contexts.SomethingContext do
  
  import Ecto.Query, warn: false

  @repo Application.get_env(:app_one, :repo)
  
  alias AppOne.Schemas.Something


  def get(id), do: @repo.get(id)

end

I think that will work and provide useful abstraction. Is that what you were thinking?