[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated (eb937c60 -> 12138ed7)
From: |
gnunet |
Subject: |
[libeufin] branch master updated (eb937c60 -> 12138ed7) |
Date: |
Tue, 10 May 2022 12:41:26 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a change to branch master
in repository libeufin.
from eb937c60 bind Nexus only to loopback
new e4746ba6 Make registrations optional.
new 7fa3465e extend --override help message
new 87323259 switch to __-wrapped placeholders
new 6c03c39d SPA
new 93f45f45 --override option affects now only the registration policy.
new c3764f2a help message
new 12138ed7 help message
The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../src/main/kotlin/tech/libeufin/sandbox/Main.kt | 40 ++++++++++++++++------
sandbox/src/main/resources/static/spa.html | 2 +-
sandbox/src/test/kotlin/StringsTest.kt | 6 ++++
3 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 4311ab9a..61ab39f8 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -136,13 +136,18 @@ class Config : CliktCommand(
private val nameArgument by argument(
"NAME", help = "Name of this configuration"
)
+ private val overrideOption by option(
+ "--override",
+ help = "Override an existing --with/--without -registrations policy." +
+ " It has NO effect on other options"
+ ).flag("--no-override", default = false)
private val currencyOption by option("--currency").default("EUR")
private val bankDebtLimitOption by
option("--bank-debt-limit").int().default(1000000)
private val usersDebtLimitOption by
option("--users-debt-limit").int().default(1000)
private val allowRegistrationsOption by option(
- "--allow-registrations",
+ "--with-registrations",
help = "(default: true)" /* mentioning here as help message did not.
*/
- ).flag(default = true)
+ ).flag("--without-registrations", default = true)
private val withSignupBonusOption by option(
"--with-signup-bonus",
help = "Award new customers with 100 units of currency!"
@@ -153,10 +158,16 @@ class Config : CliktCommand(
execThrowableOrTerminate {
dbCreateTables(dbConnString)
transaction {
- val checkExist = DemobankConfigEntity.find {
+ val maybeDemobank = DemobankConfigEntity.find {
DemobankConfigsTable.name eq nameArgument
}.firstOrNull()
- if (checkExist != null) {
+ if (maybeDemobank != null) {
+ if (overrideOption) {
+ println("Overriding the registration policy to: "
+ + allowRegistrationsOption)
+ maybeDemobank.allowRegistrations =
allowRegistrationsOption
+ return@transaction
+ }
println("Error, demobank ${nameArgument} exists already,
not overriding it.")
exitProcess(1)
}
@@ -993,20 +1004,23 @@ val sandboxApp: Application.() -> Unit = {
var content = String(spa.readBytes(), Charsets.UTF_8)
val landingUrl = System.getenv(
"TALER_ENV_URL_INTRO") ?: "https://demo.taler.net/"
- content = content.replace("%DEMO_SITE_LANDING_URL%",
landingUrl)
+ content = content.replace("__DEMO_SITE_LANDING_URL__",
landingUrl)
val bankUrl = System.getenv(
"TALER_ENV_URL_BANK") ?:
"https://demo.taler.net/sandbox/demobanks/default/"
- content = content.replace("%DEMO_SITE_BANK_URL%", bankUrl)
+ content = content.replace("__DEMO_SITE_BANK_URL__", bankUrl)
val blogUrl = System.getenv(
"TALER_ENV_URL_MERCHANT_BLOG") ?:
"https://demo.taler.net/blog/"
- content = content.replace("%DEMO_SITE_BLOG_URL%", blogUrl)
+ content = content.replace("__DEMO_SITE_BLOG_URL__", blogUrl)
val donationsUrl = System.getenv(
"TALER_ENV_URL_MERCHANT_DONATIONS") ?:
"https://demo.taler.net/donations/"
- content = content.replace("%DEMO_SITE_DONATIONS_URL%",
donationsUrl)
+ content = content.replace("__DEMO_SITE_DONATIONS_URL__",
donationsUrl)
val surveyUrl = System.getenv(
"TALER_ENV_URL_MERCHANT_SURVEY") ?:
"https://demo.taler.net/survey/"
- content = content.replace("%DEMO_SITE_SURVEY_URL%", surveyUrl)
- logger.debug("after links replacement + $content")
+ content = content.replace("__DEMO_SITE_SURVEY_URL__",
surveyUrl)
+ content = content.replace(
+ "__LIBEUFIN_UI_ALLOW_REGISTRATIONS__",
+ demobank.allowRegistrations.toString()
+ )
call.respondText(content, ContentType.Text.Html)
return@get
}
@@ -1415,6 +1429,12 @@ val sandboxApp: Application.() -> Unit = {
post("/testing/register") {
// Check demobank was created.
val demobank = ensureDemobank(call)
+ if (!demobank.allowRegistrations) {
+ throw SandboxError(
+ HttpStatusCode.UnprocessableEntity,
+ "The bank doesn't allow new registrations at the
moment."
+ )
+ }
val req = call.receiveJson<CustomerRegistration>()
val checkExist = transaction {
DemobankCustomerEntity.find {
diff --git a/sandbox/src/main/resources/static/spa.html
b/sandbox/src/main/resources/static/spa.html
index 2d272df9..61d2496e 100644
--- a/sandbox/src/main/resources/static/spa.html
+++ b/sandbox/src/main/resources/static/spa.html
@@ -6,4 +6,4 @@ https://github.com/yahoo/pure/blob/master/LICENSE.md
*//*!
normalize.css v^3.0 | MIT License | git.io/normalize
Copyright (c) Nicolas Gallagher and Jonathan Neal
-*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css
*/html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[
[...]
\ No newline at end of file
+*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css
*/html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[
[...]
\ No newline at end of file
diff --git a/sandbox/src/test/kotlin/StringsTest.kt
b/sandbox/src/test/kotlin/StringsTest.kt
index eaec275b..36503f6c 100644
--- a/sandbox/src/test/kotlin/StringsTest.kt
+++ b/sandbox/src/test/kotlin/StringsTest.kt
@@ -19,4 +19,10 @@ class StringsTest {
)
println(content)
}
+
+ @Test
+ fun booleanToString() {
+ assert(true.toString() == "true")
+ assert(false.toString() == "false")
+ }
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libeufin] branch master updated (eb937c60 -> 12138ed7),
gnunet <=
- [libeufin] 03/07: switch to __-wrapped placeholders, gnunet, 2022/05/10
- [libeufin] 01/07: Make registrations optional., gnunet, 2022/05/10
- [libeufin] 02/07: extend --override help message, gnunet, 2022/05/10
- [libeufin] 05/07: --override option affects now only the registration policy., gnunet, 2022/05/10
- [libeufin] 06/07: help message, gnunet, 2022/05/10
- [libeufin] 04/07: SPA, gnunet, 2022/05/10
- [libeufin] 07/07: help message, gnunet, 2022/05/10