diff --git a/.changeset/thin-impalas-bathe.md b/.changeset/thin-impalas-bathe.md new file mode 100644 index 0000000000..789e6a4d26 --- /dev/null +++ b/.changeset/thin-impalas-bathe.md @@ -0,0 +1,5 @@ +--- +"@core/electric": patch +--- + +Use the same TCP options for database connections regardless of whether they are initiated by epgsql or the Ecto repo. diff --git a/components/electric/lib/electric/postgres/repo.ex b/components/electric/lib/electric/postgres/repo.ex index d566c59624..8e8660f75a 100644 --- a/components/electric/lib/electric/postgres/repo.ex +++ b/components/electric/lib/electric/postgres/repo.ex @@ -29,6 +29,9 @@ defmodule Electric.Postgres.Repo do password: conn_opts.password, database: conn_opts.database, ssl: conn_opts.ssl == :required, + # Pass TCP options to the Postgrex adapter. This is used to let the adapter know to + # connect to the DB using IPv6, for example. + socket_options: Map.get(conn_opts, :tcp_opts, []), pool_size: Keyword.get(opts, :pool_size, @default_pool_size), log: false, after_connect: {__MODULE__, :set_display_settings, []}