[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: load port from config file
From: |
gnunet |
Subject: |
[libeufin] branch master updated: load port from config file |
Date: |
Fri, 22 Sep 2023 18:20:03 +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 4b9a85ae load port from config file
4b9a85ae is described below
commit 4b9a85aeb7cc1d5f279304ea57b558ae7ba3366e
Author: Florian Dold <florian@dold.me>
AuthorDate: Fri Sep 22 18:20:06 2023 +0200
load port from config file
---
bank/src/main/kotlin/tech/libeufin/bank/Main.kt | 9 ++++++++-
contrib/libeufin-bank.sample.conf | 13 +++++++++++++
util/src/main/kotlin/TalerConfig.kt | 8 ++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/Main.kt
b/bank/src/main/kotlin/tech/libeufin/bank/Main.kt
index ac3ef199..e6d90efa 100644
--- a/bank/src/main/kotlin/tech/libeufin/bank/Main.kt
+++ b/bank/src/main/kotlin/tech/libeufin/bank/Main.kt
@@ -420,10 +420,17 @@ class ServeBank : CliktCommand("Run libeufin-bank HTTP
server", name = "serve")
val ctx = readBankApplicationContextFromConfig(config)
val dbConnStr = config.requireValueString("libeufin-bank-db-postgres",
"config")
logger.info("using database '$dbConnStr'")
+ val serveMethod = config.requireValueString("libeufin-bank", "serve")
+ if (serveMethod.lowercase() != "tcp") {
+ logger.info("Can only serve libeufin-bank via TCP")
+ exitProcess(1)
+ }
+ val servePortLong = config.requireValueNumber("libeufin-bank", "port")
+ val servePort = servePortLong.toInt()
val db = Database(dbConnStr, ctx.currency)
if (!maybeCreateAdminAccount(db, ctx)) // logs provided by the helper
exitProcess(1)
- embeddedServer(Netty, port = 8080) {
+ embeddedServer(Netty, port = servePort) {
corebankWebApp(db, ctx)
}.start(wait = true)
}
diff --git a/contrib/libeufin-bank.sample.conf
b/contrib/libeufin-bank.sample.conf
new file mode 100644
index 00000000..a50fef97
--- /dev/null
+++ b/contrib/libeufin-bank.sample.conf
@@ -0,0 +1,13 @@
+[libeufin-bank]
+currency = KUDOS
+DEFAULT_CUSTOMER_DEBT_LIMIT = KUDOS:200
+DEFAULT_ADMIN_DEBT_LIMIT = KUDOS:2000
+REGISTRATION_BONUS = KUDOS:100
+REGISTRATION_BONUS_ENABLED = yes
+MAX_AUTH_TOKEN_DURATION = 1d
+
+SERVE = tcp
+PORT = 8080
+
+[libeufin-bank-db-postgres]
+CONFIG = postgresql:///libeufinbank
diff --git a/util/src/main/kotlin/TalerConfig.kt
b/util/src/main/kotlin/TalerConfig.kt
index 6ea252b2..94a001a4 100644
--- a/util/src/main/kotlin/TalerConfig.kt
+++ b/util/src/main/kotlin/TalerConfig.kt
@@ -128,6 +128,14 @@ class TalerConfig {
return entry.value
}
+ fun requireValueNumber(section: String, option: String): Long {
+ val entry = lookupEntry(section, option)
+ if (entry == null) {
+ throw TalerConfigError("expected string in configuration section
$section option $option")
+ }
+ return entry.value.toLong(10)
+ }
+
fun lookupValueBooleanDefault(section: String, option: String, default:
Boolean): Boolean {
val entry = lookupEntry(section, option)
if (entry == null) {
--
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: load port from config file,
gnunet <=