[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: pass through jdbc URIs
From: |
gnunet |
Subject: |
[libeufin] branch master updated: pass through jdbc URIs |
Date: |
Sun, 24 Sep 2023 23:42:59 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 3a6f61da pass through jdbc URIs
3a6f61da is described below
commit 3a6f61da1d111313b0bf74ccc1ce0f43eec00e52
Author: Florian Dold <florian@dold.me>
AuthorDate: Sun Sep 24 23:43:02 2023 +0200
pass through jdbc URIs
---
util/src/main/kotlin/DB.kt | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/util/src/main/kotlin/DB.kt b/util/src/main/kotlin/DB.kt
index d79038b0..7f518ebd 100644
--- a/util/src/main/kotlin/DB.kt
+++ b/util/src/main/kotlin/DB.kt
@@ -267,11 +267,22 @@ fun connectWithSchema(jdbcConn: String, schemaName:
String? = null) {
}
/**
- * This function converts a postgresql://-URI to a JDBC one.
- * It is only needed because JDBC strings based on Unix domain
- * sockets need individual intervention.
+ * This function converts postgresql:// URIs to JDBC URIs.
+ *
+ * URIs that are already jdbc: URIs are passed through.
+ *
+ * This avoids the user having to create complex JDBC URIs for postgres
connections.
+ * They are especially complex when using unix domain sockets, as they're not
really
+ * supported natively by JDBC.
*/
fun getJdbcConnectionFromPg(pgConn: String): String {
+ if (pgConn.startsWith("postgres://")) {
+ throw Exception("only the postgresql:// URI scheme is supported, not
postgres://")
+ }
+ // Pass through jdbc URIs.
+ if (pgConn.startsWith("jdbc:")) {
+ return pgConn
+ }
if (!pgConn.startsWith("postgresql://") &&
!pgConn.startsWith("postgres://")) {
logger.info("Not a Postgres connection string: $pgConn")
throw Exception("Not a Postgres connection string: $pgConn")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: pass through jdbc URIs,
gnunet <=