I have an application which targets multiple databases, it's like an application that watch applications which make reports, mediate notifications, run tasks and stuffs, in a way that is impossible to be controlled statically(in the configuration file), so i thought that it could be done starting a supervisor that supervises multiple Repo
s just changing its settings in the opts
(i was thinking in a pool of repos, something like this, sounds crazy, i know), but it's impossible since Ecto.Repo
has a macro which makes connection bound to the Repo
's module, so, there's a way to rewrite the Ecto.Repo
in a way that i can achieve my needs? I looked at ecto's sources, but i've found no solution digging alone.
I also looked at this post, but there's a possibility that the application will target multiple instances, with different users, different credentials, etc.
I've reached some solutions using Code.eval
for create Repos on-the-fly, but i don't know how "good" is it, and if it's encouraged.