Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Add new plug option: :repo #76

Closed

Conversation

lucas-nelson
Copy link

When using the plug, support a :repo option that when used will override the default repo from the configuration.

This can be used in applications that have different repos (databases) for different controllers / actions.

In my case the application has a primary and a replica MySQL database. Read actions go to the replica and write actions go to the primary. We could have configured canary just to use the primary, but that would put extra reads on the primary that ideally we would avoid.

Also there was a problem during testing because each Repo is sandboxed, so the test would create records in the replica database for testing. But, when we added canary for authorization (configured to use the primary repo), the tests failed because the primary repo sandbox did not contain the records.

When using the plug, support a `:repo` option that when used will
override the default repo from the configuration.

This can be used in applications that use different repos (databases) in
different controller actions.
@cpjk
Copy link
Owner

cpjk commented Dec 13, 2019

👋 Hey! I'm sorry for the lack of movement on this. I shouldn't have left this for so long without a reply.

I am not currently writing Elixir at all, and therefore, I think it would be irresponsible of me to review PRs on this project. I just kept putting off reviewing the issues/PRs on this repo until I started writing Elixir again, but never got around to it.

That is my mistake, and I'm really sorry about that 🙏. You put in the time to make this PR, and you deserve a response at the very least.

I've marked the project as "not being actively maintained" in the readme. Please feel free to fork it with a different name and put it up on hex with current fixes.

@cpjk cpjk closed this Dec 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants