gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: allow to specify listen host, default


From: gnunet
Subject: [libeufin] branch master updated: allow to specify listen host, default to localhost
Date: Sun, 21 Jun 2020 14:05:11 +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 83c7d6e  allow to specify listen host, default to localhost
83c7d6e is described below

commit 83c7d6e3834cbec410e7596a58d7104184c5814e
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Sun Jun 21 17:35:03 2020 +0530

    allow to specify listen host, default to localhost
---
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt             | 11 ++++++++++-
 .../src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt |  4 ++--
 2 files changed, 12 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
index 31e9e7b..f2b9419 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -21,11 +21,14 @@ package tech.libeufin.nexus
 
 import com.github.ajalt.clikt.core.CliktCommand
 import com.github.ajalt.clikt.core.ProgramResult
+import com.github.ajalt.clikt.core.context
 import com.github.ajalt.clikt.core.subcommands
+import com.github.ajalt.clikt.output.CliktHelpFormatter
 import com.github.ajalt.clikt.parameters.arguments.argument
 import com.github.ajalt.clikt.parameters.options.default
 import com.github.ajalt.clikt.parameters.options.option
 import com.github.ajalt.clikt.parameters.options.prompt
+import com.github.ajalt.clikt.parameters.types.int
 import org.jetbrains.exposed.sql.transactions.transaction
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -39,9 +42,15 @@ class NexusCommand : CliktCommand() {
 }
 
 class Serve : CliktCommand("Run nexus HTTP server") {
+    init {
+        context {
+            helpFormatter = CliktHelpFormatter(showDefaultValues = true)
+        }
+    }
     private val dbName by option().default("libeufin-nexus.sqlite3")
+    private val host by option().default("127.0.0.1")
     override fun run() {
-        serverMain(dbName)
+        serverMain(dbName, host)
     }
 }
 
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index 64d52ba..a873ef3 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -192,12 +192,12 @@ fun requireBankConnection(call: ApplicationCall, 
parameterKey: String): NexusBan
 }
 
 
-fun serverMain(dbName: String) {
+fun serverMain(dbName: String, host: String) {
     dbCreateTables(dbName)
     val client = HttpClient {
         expectSuccess = false // this way, it does not throw exceptions on != 
200 responses.
     }
-    val server = embeddedServer(Netty, port = 5001) {
+    val server = embeddedServer(Netty, port = 5001, host = host) {
         install(CallLogging) {
             this.level = Level.DEBUG
             this.logger = tech.libeufin.nexus.logger

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]