libeufin

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

commit e5aac2abb17d71003a491c9c413bfe40ebcc9753
parent d6130e578554c711e1ec0e8abcb6baeb553ed6f5
Author: MS <ms@taler.net>
Date:   Tue, 12 Jan 2021 17:14:33 +0100

provide port option

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 4+++-
Mnexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt | 4++--
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt @@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory import tech.libeufin.nexus.server.serverMain import tech.libeufin.util.CryptoUtil.hashpw import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.github.ajalt.clikt.parameters.types.int import execThrowableOrTerminate import tech.libeufin.nexus.iso20022.parseCamtMessage import tech.libeufin.util.DEFAULT_DB_CONNECTION @@ -55,10 +56,11 @@ class Serve : CliktCommand("Run nexus HTTP server") { } private val dbConnString by option().default(DEFAULT_DB_CONNECTION) private val host by option().default("127.0.0.1") + private val port by option().int().default(5001) private val logLevel by option() override fun run() { setLogLevel(logLevel) - serverMain(dbConnString, host) + serverMain(dbConnString, host, port) } } diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt @@ -209,14 +209,14 @@ fun requireBankConnection(call: ApplicationCall, parameterKey: String): NexusBan return requireBankConnectionInternal(name) } -fun serverMain(dbName: String, host: String) { +fun serverMain(dbName: String, host: String, port: Int) { execThrowableOrTerminate { dbCreateTables(dbName) } val client = HttpClient { expectSuccess = false // this way, it does not throw exceptions on != 200 responses. } - val server = embeddedServer(Netty, port = 5001, host = host) { + val server = embeddedServer(Netty, port = port, host = host) { install(CallLogging) { this.level = Level.DEBUG this.logger = tech.libeufin.nexus.logger