Skip to content

Commit

Permalink
Document using init/1 callback for dynamic repos
Browse files Browse the repository at this point in the history
Closes #585
  • Loading branch information
sorentwo committed Nov 8, 2021
1 parent d822db4 commit 99d8416
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,11 @@ The function `repo_pid/1` must return the pid of the repo for the given
instance. You can use `Registry` to register the repo (for example in the repo's
`init/2` callback) and discover it.

If your application exclusively uses dynamic repositories and doesn't specify
all credentials upfront, you must implement an `init/1` callback in your Ecto
Repo. Doing so provides the Postgres notifier with the correct credentials on
init, allowing jobs to process as expected.

[dynamic]: https://hexdocs.pm/ecto/replicas-and-dynamic-repositories.html#dynamic-repositories

<!-- MDOC -->
Expand Down

0 comments on commit 99d8416

Please sign in to comment.