Closed jphenow closed 1 year ago
@jphenow Opened https://github.com/vapor/postgres-kit/pull/248 to take care of this and a few other outstanding annoyances about the URL parser in one go - let me know if I missed anything!
This looks great! Thanks @gwynne!
Is your feature request related to a problem? Please describe.
Fly.io generates Database URLs using somewhat standard
sslmode
params in the GET params. The URL parsing inpostgres-kit
doesn't take the more standardsslmode
params into account as expressed in Postgres docs.Postgres Docs specify a few options:
Where the current postgres-kit implementation accepts:
https://github.com/vapor/postgres-kit/blob/main/Sources/PostgresKit/SQLPostgresConfiguration.swift#L51C1-L54C37
ssl
ortls
(whichever is first) the valuesrequire
,true
,false
.It seems that require does the Postgres documented
require
above,true
isprefer
,false
isdisable
.Describe the solution you'd like
I presume some folks are already using these ssl/tls options that are described. I'd propose a solution that accepts the more specific
sslmode
rules and in the absence ofsslmode
follows the current behavior.Perhaps the current behavior can be deprecated at some point to follow one implementation.
I opened a branch to illustrate. Excuse the amateur Swift https://github.com/vapor/postgres-kit/compare/main...jphenow:swift-postgres-kit:jphenow/sslmode-param
Describe alternatives you've considered
We were able to get around it by altering the params by hand.
This is less ideal because Fly.io users receive this URL in their app automatically. Having to dig around that URL and write a secret by hand for this isn't great.
Additional context
https://community.fly.io/t/error-on-deploy-with-vapor-migration/14399/6