gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] 03/04: Testing environment.


From: gnunet
Subject: [libeufin] 03/04: Testing environment.
Date: Fri, 13 Nov 2020 14:31:59 +0100

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

ms pushed a commit to branch master
in repository libeufin.

commit cce6694a3bde653573d2ff0f0c88658f8cd9d612
Author: MS <ms@taler.net>
AuthorDate: Fri Nov 13 14:03:29 2020 +0100

    Testing environment.
    
    Fetch database connection string from /service-config.
---
 cli/libeufin-cli      | 33 ++++++++++++++++-----------------
 cli/setup-template.sh | 10 +++-------
 2 files changed, 19 insertions(+), 24 deletions(-)

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..44ace03 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 (db: $NEXUS_DATABASE)"
+libeufin-nexus superuser --db-name $NEXUS_DATABASE --password $NEXUS_PASSWORD 
$NEXUS_USER
 sleep 2
 
 # create a bank connection

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