Skip to content

Commit

Permalink
fix: allow IPv6 for DB_HOST (#1250)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipecabaco authored Dec 18, 2024
1 parent 93b5717 commit 7b1373f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ database = System.get_env("DB_NAME", "postgres")
port = System.get_env("DB_PORT", "5432")
slot_name_suffix = System.get_env("SLOT_NAME_SUFFIX")

socket_options =
case Realtime.Database.detect_ip_version(default_db_host) do
{:ok, ip_version} -> [ip_version]
{:error, reason} -> raise "Failed to detect IP version for DB_HOST: #{reason}"
end

config :realtime,
tenant_max_bytes_per_second:
System.get_env("TENANT_MAX_BYTES_PER_SECOND", "100000") |> String.to_integer(),
Expand Down Expand Up @@ -122,7 +128,8 @@ if config_env() != :test do
parameters: [
application_name: "supabase_mt_realtime"
],
after_connect: after_connect_query_args
after_connect: after_connect_query_args,
socket_options: socket_options

replica_repos = %{
Realtime.Repo.Replica.FRA => System.get_env("DB_HOST_REPLICA_FRA", default_db_host),
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Realtime.MixProject do
def project do
[
app: :realtime,
version: "2.33.69",
version: "2.33.70",
elixir: "~> 1.17.3",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit 7b1373f

Please sign in to comment.