From fa9f42085f689c59c40a25e4916e70eec307ca0d Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:23:10 +0700 Subject: [PATCH] avoid overwriting ssl opts with url if already set in config --- lib/ecto/repo/supervisor.ex | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ecto/repo/supervisor.ex b/lib/ecto/repo/supervisor.ex index 42d3584056..25d082f9b5 100644 --- a/lib/ecto/repo/supervisor.ex +++ b/lib/ecto/repo/supervisor.ex @@ -25,7 +25,15 @@ defmodule Ecto.Repo.Supervisor do case repo_init(type, repo, config) do {:ok, config} -> {url, config} = Keyword.pop(config, :url) - {:ok, Keyword.merge(config, parse_url(url || ""))} + url_config = parse_url(url || "") + + url_config = + cond do + is_list(config[:ssl]) and url_config[:ssl] == true -> Keyword.delete(url_config, :ssl) + true -> url_config + end + + {:ok, Keyword.merge(config, url_config)} :ignore -> :ignore