-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(pg-connection-string): get closer to libpq semantics for sslmode
#2709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
1bc03de
c3aebe7
8d56f86
1164593
f16737e
165b5c6
ab4d185
7aa88ad
89161f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,20 +87,49 @@ function parse(str) { | |
config.ssl.ca = fs.readFileSync(config.sslrootcert).toString() | ||
} | ||
|
||
switch (config.sslmode) { | ||
case 'disable': { | ||
config.ssl = false | ||
break | ||
} | ||
case 'prefer': | ||
case 'require': | ||
case 'verify-ca': | ||
case 'verify-full': { | ||
break | ||
if (config.sslcompat === 'libpq') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rather than using a value from the connection string, I think it'd be better to have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then every application using this library has to implement this out-of-band, right? That's simply not going to happen, so from a user perspective this effectively wouldn't fix the issue of not supporting standard libpq connection strings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this would be an application concern, not a user choice? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many libraries that wrap |
||
switch (config.sslmode) { | ||
case 'disable': { | ||
config.ssl = false | ||
break | ||
} | ||
case 'prefer': { | ||
config.ssl.rejectUnauthorized = false | ||
break | ||
} | ||
case 'require': { | ||
if (config.sslrootcert) { | ||
// If a root CA is specified, behavior of `sslmode=require` will be the same as that of `verify-ca` | ||
config.ssl.checkServerIdentity = function () {} | ||
} else { | ||
config.ssl.rejectUnauthorized = false | ||
} | ||
break | ||
} | ||
case 'verify-ca': { | ||
config.ssl.checkServerIdentity = function () {} | ||
break | ||
} | ||
case 'verify-full': { | ||
break | ||
} | ||
} | ||
case 'no-verify': { | ||
config.ssl.rejectUnauthorized = false | ||
break | ||
} else { | ||
switch (config.sslmode) { | ||
case 'disable': { | ||
config.ssl = false | ||
break | ||
} | ||
case 'prefer': | ||
case 'require': | ||
case 'verify-ca': | ||
case 'verify-full': { | ||
break | ||
} | ||
case 'no-verify': { | ||
config.ssl.rejectUnauthorized = false | ||
break | ||
} | ||
} | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.