Skip to content

Instantly share code, notes, and snippets.

@jarlah
Created May 9, 2020 08:04
Show Gist options
  • Save jarlah/548a922c1eb2c82dbe7e2475ba016ddb to your computer and use it in GitHub Desktop.
Save jarlah/548a922c1eb2c82dbe7e2475ba016ddb to your computer and use it in GitHub Desktop.
Play Scala and Slick 3: How to connect to postgresql database that requires certificate for connecting
slick.dbs.default.profile = "slick.jdbc.PostgresProfile$"
slick.dbs.default.db.driver = "org.postgresql.Driver"
slick.dbs.default.db.url = "jdbc:postgresql://localhost:5432/<db>"
slick.dbs.default.db.user = "<user>"
slick.dbs.default.db.password = "<password>"
slick.dbs.default.db.properties.ssl = "true"
slick.dbs.default.db.properties.sslmode = "verify-ca"
slick.dbs.default.db.properties.sslfactory = "org.postgresql.ssl.jdbc4.LibPQFactory"
slick.dbs.default.db.properties.sslpassword = "<pass>" // or comment out if no password on postgresql.pk8
slick.dbs.default.db.properties.sslcert = "<path>/postgresql.crt" // the client certificate
slick.dbs.default.db.properties.sslrootcert = "<path>/root.crt" // the ... root .. certificate ;)
slick.dbs.default.db.properties.sslkey = "<path>/postgresql.pk8" // the private key
@jarlah
Copy link
Author

jarlah commented May 9, 2020

the private key, postgresql.key, must be converted to .pk8 format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment