SysML-v2-API-Services
SysML-v2-API-Services copied to clipboard
add junixsocket to deps to enable socket file based postgresql connection
trafficstars
See https://github.com/Systems-Modeling/SysML-v2-API-Services/pull/109/commits/c85217b2be0f8b15dca26df9814fd080928dd268
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:
- https://jdbc.postgresql.org/documentation/use/#unix-sockets
- https://kohlschutter.github.io/junixsocket/dependency.html#postgresql
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")