Skip to content

Commit 45cae9b

Browse files
committed
controllers: Use specified database to connect.
By default, Postgres uses the database given by the username, which may not be present. Since we already have the target database name specified in the configuration, we can use that instead.
1 parent b146cfe commit 45cae9b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

controllers/utils/utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func SetupPostgresConnection(
4747
string(secretRef.Data["POSTGRES_PASSWORD"]),
4848
),
4949
Host: fmt.Sprintf("%s:%d", ref.Host, ref.Port),
50+
Path: fmt.Sprintf("/%s", ref.Database),
5051
RawPath: ref.Database,
5152
}
5253
conn, err := pgx.Connect(ctx, connURL.String())

0 commit comments

Comments
 (0)