Skip to content

add junixsocket to deps to enable socket file based postgresql connection #110

@wucke13

Description

@wucke13

See c85217b

This commit adds the junixsocket library to the dependencies. This
allows the usage of a UNIX domain socket connection to a postgresql
server. This promises both better performance, and it allows to use
a Linux user identity for authentication against the DB (versus
username/password auth for TCP/IP based communication to the DB).

The change is non-intrusive, i.e. per default TCP/IP is still used and
works as intended.

For more information, checkout:

In particular, setting the following two properties in the
persistence.xml suffices to connect to a postgresql via a socket file:

javax.persistence.jdbc.url='jdbc:postgresql://localhost/db-name?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$SystemProperty'
org.newsclub.net.unix.socket.default=/run/postgresql/.s.PGSQL.5432
diff --git a/build.sbt b/build.sbt
index 80054dd..12ec88b 100644
--- a/build.sbt
+++ b/build.sbt
@@ -18,6 +18,7 @@ libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.9.
 libraryDependencies += "com.fasterxml.jackson.datatype" % "jackson-datatype-hibernate5" % "2.9.8"
 libraryDependencies += "io.swagger" % "swagger-play2_2.12" % "1.6.0"
 libraryDependencies += "org.reflections" % "reflections" % "0.9.10"
+libraryDependencies += "com.kohlschutter.junixsocket" % "junixsocket-core" % "2.8.3"
 
 javacOptions ++= Seq("-s", "app")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions