gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated (d7ff9d9 -> 30e97ba)


From: gnunet
Subject: [libeufin] branch master updated (d7ff9d9 -> 30e97ba)
Date: Fri, 13 Nov 2020 14:31:56 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a change to branch master
in repository libeufin.

    from d7ff9d9  Idea files
     new 3a50b74  'dev' option to install
     new cfbb0ee  /service-config
     new cce6694  Testing environment.
     new 30e97ba  Testing environment.

The 4 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:
 .gitignore                                         |  5 +++-
 Makefile                                           | 26 +++++++++++++++--
 cli/libeufin-cli                                   | 33 +++++++++++-----------
 cli/setup-template.sh                              | 14 ++++-----
 nexus/libeufin-nexus-dev-template                  |  8 ++++++
 .../main/kotlin/tech/libeufin/nexus/Scheduling.kt  |  2 +-
 .../tech/libeufin/nexus/server/NexusServer.kt      | 12 ++++++--
 sandbox/libeufin-sandbox-dev-template              |  8 ++++++
 8 files changed, 77 insertions(+), 31 deletions(-)
 create mode 100644 nexus/libeufin-nexus-dev-template
 create mode 100644 sandbox/libeufin-sandbox-dev-template

diff --git a/.gitignore b/.gitignore
index 3a4ba95..92d2b7d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
-build
+nexus/libeufin-nexus-dev
+sandbox/libeufin-sandbox-dev
+configure
+build*
 .gradle
 out
 *.sqlite3
diff --git a/Makefile b/Makefile
index 23bfeed..2ef567a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,37 @@
 include build-system/config.mk
 
+escaped_pwd = $(shell pwd | sed 's/\//\\\//g')
+
 install: install-nexus install-cli
+install-dev: install-nexus-dev install-sandbox-dev install-cli
+
+.PHONY: install-sandbox
 install-sandbox:
-       @echo Installing sandbox.
+       @echo Installing Sandbox.
        @./gradlew -q -Pprefix=$(prefix) sandbox:installToPrefix; cd ..
 
+.PHONY: install-sandbox-dev
+install-sandbox-dev:
+       @echo Installing Sandbox "dev".
+       @sed 's/PROJECT/$(escaped_pwd)/' sandbox/libeufin-sandbox-dev-template 
> sandbox/libeufin-sandbox-dev
+       @install -D sandbox/libeufin-sandbox-dev $(prefix)/bin/libeufin-sandbox
+
+.PHONY: install-nexus
 install-nexus:
-       @echo Installing nexus.
+       @echo Installing Nexus.
        @./gradlew -q -Pprefix=$(prefix) nexus:installToPrefix; cd ..
 
+.PHONY: install-nexus-dev
+install-nexus-dev:
+       @echo Installing Nexus "dev".
+       @sed 's/PROJECT/$(escaped_pwd)/' nexus/libeufin-nexus-dev-template > 
nexus/libeufin-nexus-dev
+       @install -D nexus/libeufin-nexus-dev $(prefix)/bin/libeufin-nexus
+
+.PHONY: install-cli
 install-cli:
        @echo Installing CLI.
-       @cp cli/libeufin-cli $(prefix)/bin
+       @install -D cli/libeufin-cli $(prefix)/bin
 
+.PHONY: assemble
 assemble:
        @./gradlew assemble
diff --git a/cli/libeufin-cli b/cli/libeufin-cli
index ab42881..908cecc 100755
--- a/cli/libeufin-cli
+++ b/cli/libeufin-cli
@@ -112,8 +112,7 @@ def restore_backup(obj, backup_file, passphrase, 
connection_name):
         backup = open(backup_file, "r")
     except Exception:
         print("Could not open the backup at {}".format(backup_file))
-        return
-
+        exit(1)
     backup_json = json.loads(backup.read())
     backup.close()
 
@@ -168,7 +167,7 @@ def sync(obj, connection_name):
         resp = post(url, json=dict(), auth = auth.HTTPBasicAuth(obj.username, 
obj.password))
     except Exception:
         print(f"Could not reach nexus at {url}")
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @connections.command(help="import one bank account, chosen from the downloaded 
ones")
@@ -189,7 +188,7 @@ def import_bank_account(obj, connection_name, 
offered_account_id, nexus_bank_acc
         )
     except Exception as e:
         print(f"Could not reach nexus at {url}: {e}")
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @connections.command(help="download bank accounts in raw format WITHOUT 
importing them")
@@ -201,7 +200,7 @@ def download_bank_accounts(obj, connection_name):
         resp = post(url, json=dict(), auth = auth.HTTPBasicAuth(obj.username, 
obj.password))
     except Exception:
         print("Could not reach nexus at " + url)
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @connections.command(help="list the connections")
@@ -212,7 +211,7 @@ def list_connections(obj):
         resp = get(url, json=dict(), auth = auth.HTTPBasicAuth(obj.username, 
obj.password))
     except Exception:
         print("Could not reach nexus at " + url)
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @connections.command(help="list bank accounts hosted at one connection")
@@ -224,7 +223,7 @@ def list_offered_bank_accounts(obj, connection_name):
         resp = get(url, json=dict(), auth = auth.HTTPBasicAuth(obj.username, 
obj.password))
     except Exception:
         print("Could not reach nexus at " + url)
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @accounts.command(help="show accounts belonging to calling user")
@@ -235,7 +234,7 @@ def show(obj):
         resp = get(url, auth=auth.HTTPBasicAuth(obj.username, obj.password))
     except Exception as e:
         print(f"Could not reach nexus at {url}, error: {e}")
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @accounts.command(help="prepare payment debiting 'account-name'")
@@ -261,7 +260,7 @@ def prepare_payment(obj, account_name, credit_iban, 
credit_bic, credit_name,
         resp = post(url, json=body, auth=auth.HTTPBasicAuth(obj.username, 
obj.password))
     except Exception:
         print("Could not reach nexus at " + url)
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @accounts.command(help="submit a prepared payment")
@@ -277,7 +276,7 @@ def submit_payment(obj, account_name, payment_uuid):
         resp = post(url, json=dict(), auth = auth.HTTPBasicAuth(obj.username, 
obj.password))
     except Exception:
         print("Could not reach nexus at" + url)
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @accounts.command(help="fetch transactions from the bank")
@@ -291,7 +290,7 @@ def fetch_transactions(obj, account_name):
         resp = post(url, auth = auth.HTTPBasicAuth(obj.username, obj.password))
     except Exception:
         print("Could not reach nexus " + url)
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @accounts.command(help="get transactions from the simplified nexus JSON API")
@@ -303,7 +302,7 @@ def transactions(obj, account_name):
         resp = get(url, auth = auth.HTTPBasicAuth(obj.username, obj.password))
     except Exception:
         print("Could not reach nexus " + url)
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @taler_facade.command(help="create a new Taler facade")
@@ -330,7 +329,7 @@ def new_facade(obj, facade_name, connection_name, 
account_name):
         )))
     except Exception:
         print("Could not reach sandbox")
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @sandbox.command(help="activate a Ebics host")
@@ -343,7 +342,7 @@ def make_ebics_host(obj, host_id, sandbox_base_url):
         resp = post(url, json=dict(hostID=host_id, ebicsVersion="2.5"))
     except Exception:
         print("Could not reach sandbox")
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @sandbox.command(help="activate a Ebics subscriber")
@@ -358,7 +357,7 @@ def activate_ebics_subscriber(obj, host_id, partner_id, 
user_id, sandbox_base_ur
         resp = post(url, json=dict(hostID=host_id, partnerID=partner_id, 
userID=user_id))
     except Exception:
         print("Could not reach sandbox")
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @sandbox.command(help="associate a bank account to a Ebics subscriber")
@@ -383,7 +382,7 @@ def associate_bank_account(obj, iban, bic, person_name, 
account_name,
         resp = post(url, json=body)
     except Exception:
         print("Could not reach sandbox")
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 @sandbox.command(help="book a payment in the sandbox")
@@ -417,7 +416,7 @@ def book_payment(obj, creditor_iban, creditor_bic, 
creditor_name, debtor_iban,
         resp = post(url, json=body)
     except Exception:
         print("Could not reach sandbox")
-        return
+        exit(1)
     print(resp.content.decode("utf-8"))
 
 cli()
diff --git a/cli/setup-template.sh b/cli/setup-template.sh
index a006b53..b4e6285 100755
--- a/cli/setup-template.sh
+++ b/cli/setup-template.sh
@@ -23,11 +23,6 @@ NEXUS_USER=u
 NEXUS_PASSWORD=p
 NEXUS_BANK_CONNECTION_NAME=b
 
-if test -z $1; then
-  echo usage: ./setup-template.sh PATH-TO-NEXUS-DB
-  exit 1
-fi
-
 # Exports needed by the CLI.
 export NEXUS_BASE_URL="http://localhost:5001/";
 export NEXUS_USERNAME=$NEXUS_USER
@@ -73,8 +68,9 @@ sleep 2
 ########## setup nexus #############
 
 # create a user
-echo "Creating a nexus user (giving time to settle)"
-libeufin-nexus superuser --db-name $1 --password $NEXUS_PASSWORD $NEXUS_USER
+NEXUS_DATABASE=$(curl -s $NEXUS_BASE_URL/service-config | jq .dbConn | tr -d 
\" | awk -F: '{print $2}')
+echo "Creating a nexus superuser"
+libeufin-nexus superuser --db-name $NEXUS_DATABASE --password $NEXUS_PASSWORD 
$NEXUS_USER &> /dev/null
 sleep 2
 
 # create a bank connection
@@ -99,3 +95,7 @@ echo Download bank accounts
 ./libeufin-cli \
   connections download-bank-accounts \
     $NEXUS_BANK_CONNECTION_NAME > /dev/null
+
+echo Note: NEXUS_USERNAME, NEXUS_PASSWORD, and NEXUS_BASE_URL
+echo have been *already* exported in this shell.  Bank connection
+echo $(tput bold)a$(tput sgr0) can be soon used via the $(tput 
bold)libeufin-cli$(tput sgr0) utility!
diff --git a/nexus/libeufin-nexus-dev-template 
b/nexus/libeufin-nexus-dev-template
new file mode 100644
index 0000000..8383497
--- /dev/null
+++ b/nexus/libeufin-nexus-dev-template
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+ARGS="$@"
+cd PROJECT
+if (( $# > 0 )); then ./gradlew --console=plain nexus:run --args="$ARGS"
+else ./gradlew --console=plain nexus:run
+fi
+cd - > /dev/null
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
index 286e4d7..3af086a 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
@@ -90,7 +90,7 @@ object NexusCron {
 fun startOperationScheduler(httpClient: HttpClient) {
     GlobalScope.launch {
         while (true) {
-            logger.info("running schedule loop")
+            logger.trace("running schedule loop")
 
             // First, assign next execution time stamps to all tasks that need 
them
             transaction {
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 c31d7de..b5b0afb 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -65,6 +65,7 @@ import tech.libeufin.util.*
 import tech.libeufin.nexus.logger
 import java.lang.IllegalArgumentException
 import java.net.URLEncoder
+import java.nio.file.Paths
 import java.util.zip.InflaterInputStream
 
 
@@ -279,13 +280,20 @@ fun serverMain(dbName: String, host: String) {
         }
         startOperationScheduler(client)
         routing {
+            get("/service-config") {
+                call.respond(
+                    object {
+                        val dbConn = 
"sqlite://${Paths.get(dbName).toAbsolutePath()}"
+                    }
+                )
+                return@get
+            }
+
             get("/config") {
                  call.respond(
                      object {
                          val version = "0.0.0"
                          val currency = "EUR"
-                         val databaseType = "sqlite"
-                         val databaseName = dbName
                      }
                  )
                 return@get
diff --git a/sandbox/libeufin-sandbox-dev-template 
b/sandbox/libeufin-sandbox-dev-template
new file mode 100644
index 0000000..2e284c0
--- /dev/null
+++ b/sandbox/libeufin-sandbox-dev-template
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+ARGS="$@"
+cd PROJECT
+if (( $# > 0 )); then ./gradlew --console=plain sandbox:run --args="$ARGS"
+else ./gradlew --console=plain sandbox:run
+fi
+cd - > /dev/null

-- 
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]