Skip to content

Commit

Permalink
fix: Don't send options connection parameter unless supplied (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
Soremwar authored Jun 7, 2022
1 parent 4d94baa commit f986bb8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions connection/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,14 @@ export class Connection {
writer.addCString("application_name").addCString(
this.#connection_params.applicationName,
);
// The database expects options in the --key=value
writer.addCString("options").addCString(
Object.entries(this.#connection_params.options).map(([key, value]) =>
`--${key}=${value}`
).join(" "),
);

const connection_options = Object.entries(this.#connection_params.options);
if (connection_options.length > 0) {
// The database expects options in the --key=value
writer.addCString("options").addCString(
connection_options.map(([key, value]) => `--${key}=${value}`).join(" "),
);
}

// terminator after all parameters were writter
writer.addCString("");
Expand Down

0 comments on commit f986bb8

Please sign in to comment.