libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 2074af0e9337273ba4eabeeff9ca1f8c97391878
parent c9b5e38e7cda03aa0dd66b7720fff8b0eb02c8f3
Author: MS <ms@taler.net>
Date:   Tue,  8 Dec 2020 14:08:20 +0100

fix connection to PostgreSQL

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/DB.kt | 8++++++--
Mnexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 4++--
Msandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt | 6+++++-
Msandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 3+--
4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt @@ -30,6 +30,7 @@ import org.jetbrains.exposed.sql.transactions.transaction import tech.libeufin.nexus.iso20022.EntryStatus import tech.libeufin.util.EbicsInitState import tech.libeufin.util.amount +import java.net.URLEncoder import java.sql.Connection /** @@ -93,7 +94,6 @@ object NexusBankMessagesTable : IntIdTable() { class NexusBankMessageEntity(id: EntityID<Int>) : IntEntity(id) { companion object : IntEntityClass<NexusBankMessageEntity>(NexusBankMessagesTable) - var bankConnection by NexusBankConnectionEntity referencedOn NexusBankMessagesTable.bankConnection var messageId by NexusBankMessagesTable.messageId var code by NexusBankMessagesTable.code @@ -385,7 +385,11 @@ class NexusScheduledTaskEntity(id: EntityID<Int>) : IntEntity(id) { } fun dbCreateTables(dbName: String) { - Database.connect("jdbc:postgresql:${dbName}", "org.postgresql.Driver", user = "libeufin") + Database.connect( + "jdbc:postgresql://127.0.0.1:5433/${dbName}", + "org.postgresql.Driver", + user = "libeufin" + ) TransactionManager.manager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE transaction { addLogger(StdOutSqlLogger) diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt @@ -51,7 +51,7 @@ class Serve : CliktCommand("Run nexus HTTP server") { helpFormatter = CliktHelpFormatter(showDefaultValues = true) } } - private val dbName by option().default("libeufin-nexus.sqlite3") + private val dbName by option().default("libeufindb") private val host by option().default("127.0.0.1") private val logLevel by option() override fun run() { @@ -72,7 +72,7 @@ class ParseCamt : CliktCommand("Parse a camt file") { } class Superuser : CliktCommand("Add superuser or change pw") { - private val dbName by option().default("libeufin-nexus.sqlite3") + private val dbName by option().default("libeufindb") private val username by argument() private val password by option().prompt(requireConfirmation = true, hideInput = true) override fun run() { diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt @@ -302,7 +302,11 @@ object BankAccountReportsTable : IntIdTable() { } fun dbCreateTables(dbName: String) { - Database.connect("jdbc:postgresql:${dbName}", "org.postgresql.Driver") + Database.connect( + "jdbc:postgresql://127.0.0.1:5433/${dbName}", + "org.postgresql.Driver", + user = "libeufin" + ) TransactionManager.manager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE transaction { addLogger(StdOutSqlLogger) diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -93,7 +93,7 @@ class SandboxCommand : CliktCommand() { } class Serve : CliktCommand("Run sandbox HTTP server") { - private val dbName by option().default("libeufin-sandbox.sqlite3") + private val dbName by option().default("libeufindb") private val logLevel by option() override fun run() { LOGGER = LoggerFactory.getLogger("tech.libeufin.sandbox") @@ -378,7 +378,6 @@ fun serverMain(dbName: String) { this.authenticationPrivateKey = ExposedBlob(pairA.private.encoded) this.encryptionPrivateKey = ExposedBlob(pairB.private.encoded) this.signaturePrivateKey = ExposedBlob(pairC.private.encoded) - } } call.respondText(