Skip to content

Commit

Permalink
fix: set correct database on connection (#565)
Browse files Browse the repository at this point in the history
Closes #562
  • Loading branch information
hauleth authored Jan 21, 2025
1 parent c595f4a commit 368d9fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.18
2.0.19
6 changes: 4 additions & 2 deletions lib/supavisor/client_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ defmodule Supavisor.ClientHandler do

case Tenants.get_user_cache(type, user, tenant_or_alias, sni_hostname) do
{:ok, info} ->
db_name = if(db_name != nil, do: db_name, else: info.tenant.db_database)
db_name = db_name || info.tenant.db_database

id =
Supavisor.id(
Expand Down Expand Up @@ -801,9 +801,11 @@ defmodule Supavisor.ClientHandler do
do: :password,
else: :auth_query

db_name = db_name || info.tenant.db_database

auth = %{
application_name: data[:app_name] || "Supavisor",
database: info.tenant.db_database,
database: db_name,
host: to_charlist(info.tenant.db_host),
sni_hostname:
if(info.tenant.sni_hostname != nil, do: to_charlist(info.tenant.sni_hostname)),
Expand Down

0 comments on commit 368d9fc

Please sign in to comment.