-
Notifications
You must be signed in to change notification settings - Fork 760
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dev binding parsing for hyperdrive to correctly format address (#727
- Loading branch information
1 parent
a098c7d
commit 6bdf26c
Showing
1 changed file
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,15 @@ export const HyperdriveSchema = z | |
"You must provide a hostname or IP address in your connection string - e.g. 'user:[email protected]:5432/databasename", | ||
}); | ||
} | ||
if (url.port === "") { | ||
let port: string | undefined; | ||
if ( | ||
url.port === "" && | ||
(url.protocol === "postgresql:" || url.protocol == "postgres:") | ||
) { | ||
port = "5432"; | ||
} else if (url.port !== "") { | ||
port = url.port; | ||
} else { | ||
ctx.addIssue({ | ||
code: z.ZodIssueCode.custom, | ||
message: | ||
|
@@ -65,8 +73,8 @@ export const HyperdriveSchema = z | |
user: url.username, | ||
password: url.password, | ||
scheme: url.protocol.replace(":", ""), | ||
host: url.host, | ||
port: url.port, | ||
host: url.hostname, | ||
port: port, | ||
}; | ||
}); | ||
|
||
|