From b386c39331993a78d5a9b584dc85e8efad6a2d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 24 Dec 2023 21:43:13 +0100 Subject: [PATCH] Improve docs to Ecto.Repo.init/2 --- lib/ecto/repo.ex | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/ecto/repo.ex b/lib/ecto/repo.ex index a4edec9a61..5128dd3034 100644 --- a/lib/ecto/repo.ex +++ b/lib/ecto/repo.ex @@ -79,14 +79,6 @@ defmodule Ecto.Repo do config :my_app, Repo, url: "ecto://postgres:postgres@localhost/ecto_simple?ssl=true&pool_size=10" - In case the URL needs to be dynamically configured, for example by - reading a system environment variable, such can be done via the - `c:init/2` repository callback: - - def init(_type, config) do - {:ok, Keyword.put(config, :url, System.get_env("DATABASE_URL"))} - end - ## Shared options Almost all of the repository functions outlined in this module accept the following @@ -608,6 +600,9 @@ defmodule Ecto.Repo do @doc """ A callback executed when the repo starts or when configuration is read. + This callback is available for backwards compatibility purposes. Most + runtime configuration in Elixir today can be done via config/runtime.exs. + The first argument is the context the callback is being invoked. If it is called because the Repo supervisor is starting, it will be `:supervisor`. It will be `:runtime` if it is called for reading configuration without