diff options
author | ms <ms@taler.net> | 2021-01-14 16:53:21 +0100 |
---|---|---|
committer | ms <ms@taler.net> | 2021-01-14 16:53:21 +0100 |
commit | 57588f74945f34d72633d4ac6429d0e81c24e9d0 (patch) | |
tree | d25b01efa79199ea3a1562feff198cd473f5605d /cli | |
parent | 0e77ba849b15c7c7a7332c8715bc30619e851c4c (diff) | |
download | libeufin-57588f74945f34d72633d4ac6429d0e81c24e9d0.tar.gz libeufin-57588f74945f34d72633d4ac6429d0e81c24e9d0.tar.bz2 libeufin-57588f74945f34d72633d4ac6429d0e81c24e9d0.zip |
Prepare env for CLI.
Diffstat (limited to 'cli')
-rwxr-xr-x | cli/setup-template.sh | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/cli/setup-template.sh b/cli/setup-template.sh index 3088a883..a893e9b5 100755 --- a/cli/setup-template.sh +++ b/cli/setup-template.sh @@ -5,6 +5,10 @@ set -eu +SQLITE_FILE="/tmp/libeufin-cli-env.sqlite3" +DATABASE_CONN="jdbc:sqlite:$SQLITE_FILE" +CURRENCY="EUR" + # EBICS details. SANDBOX_URL="http://localhost:5000" EBICS_HOST_ID=ebicshost @@ -29,33 +33,43 @@ export NEXUS_BASE_URL="http://localhost:5001/" export NEXUS_USERNAME=$NEXUS_USER export NEXUS_PASSWORD=$NEXUS_PASSWORD +echo Remove old database. +rm -f $SQLITE_FILE + +echo Start services. +libeufin-nexus serve --db-conn-string=$DATABASE_CONN &> nexus.log & +nexus_pid=$! +libeufin-sandbox serve --db-conn-string=$DATABASE_CONN &> sandbox.log & +sandbox_pid=$! + +trap "echo Terminating services.; kill $nexus_pid; kill $sandbox_pid" EXIT + +curl -s --retry 5 --retry-connrefused $SANDBOX_URL > /dev/null +curl -s --retry 5 --retry-connrefused $NEXUS_BASE_URL > /dev/null + ########## setup sandbox ############# # make ebics host at sandbox echo Making a ebics host at the sandbox -sleep 2 -./libeufin-cli \ - sandbox \ - make-ebics-host \ - --host-id=$EBICS_HOST_ID \ - $SANDBOX_URL +./bin/libeufin-cli \ + sandbox --sandbox-url=$SANDBOX_URL \ + ebicshost create \ + --host-id=$EBICS_HOST_ID # activate a ebics subscriber on that host echo Activating the ebics subscriber at the sandbox -sleep 2 -./libeufin-cli \ - sandbox \ - activate-ebics-subscriber \ +./bin/libeufin-cli \ + sandbox --sandbox-url=$SANDBOX_URL \ + ebicssubscriber create \ --host-id=$EBICS_HOST_ID \ --partner-id=$EBICS_PARTNER_ID \ - --user-id=$EBICS_USER_ID \ - $SANDBOX_URL + --user-id=$EBICS_USER_ID # give a bank account to such user echo Giving a bank account to such subscriber -./libeufin-cli \ - sandbox \ - associate-bank-account \ +./bin/libeufin-cli \ + sandbox --sandbox-url=$SANDBOX_URL \ + ebicsbankaccount create \ --iban=$IBAN \ --bic=$BIC \ --person-name=$PERSON_NAME \ @@ -63,20 +77,20 @@ echo Giving a bank account to such subscriber --ebics-user-id=$EBICS_USER_ID \ --ebics-host-id=$EBICS_HOST_ID \ --ebics-partner-id=$EBICS_PARTNER_ID \ - $SANDBOX_URL -sleep 2 + --currency=$CURRENCY ########## setup nexus ############# # create a 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 +libeufin-nexus \ + superuser \ + --db-conn-string=$DATABASE_CONN \ + --password $NEXUS_PASSWORD $NEXUS_USER &> /dev/null # create a bank connection echo Creating a bank connection for such user -./libeufin-cli \ +./bin/libeufin-cli \ connections \ new-ebics-connection \ --ebics-url $EBICS_BASE_URL \ @@ -84,21 +98,20 @@ echo Creating a bank connection for such user --partner-id $EBICS_PARTNER_ID \ --ebics-user-id $EBICS_USER_ID \ $NEXUS_BANK_CONNECTION_NAME > /dev/null -sleep 2 # Bootstrapping such connection. echo Bootstrapping the bank connection -./libeufin-cli \ +./bin/libeufin-cli \ connections sync $NEXUS_BANK_CONNECTION_NAME > /dev/null # Download bank accounts. echo Download bank accounts -./libeufin-cli \ +./bin/libeufin-cli \ connections download-bank-accounts \ $NEXUS_BANK_CONNECTION_NAME > /dev/null # Import bank account for user. -./libeufin-cli \ +./bin/libeufin-cli \ connections import-bank-account \ --offered-account-id=$ACCOUNT_NAME \ --nexus-bank-account-id=$ACCOUNT_NAME_AT_NEXUS \ |