libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit b44269302ae1dd3ca22f22c41223e3fef351a7c7
parent 9e604f86c3a0896a28a6ec0bbcf8e144d62c3b56
Author: Antoine A <>
Date:   Thu, 11 Dec 2025 09:57:05 +0100

dbconfig: fix missing rights for conversion setup and fix config flags

Diffstat:
Acontrib/ci/deb-test.sh | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcontrib/ci/jobs/4-deb/job.sh | 2+-
Dcontrib/ci/jobs/4-deb/test.sh | 46----------------------------------------------
Mcontrib/libeufin-dbconfig | 18++++++++----------
4 files changed, 63 insertions(+), 57 deletions(-)

diff --git a/contrib/ci/deb-test.sh b/contrib/ci/deb-test.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -eu + +function step { + echo -e "\n$@" >&2 +} + +ITEMS="libeufin-bank libeufin-nexus" + +step "Install libeufin" +dpkg -i ../libeufin*.deb + +step "Install libeufin again" +dpkg -i ../libeufin*.deb + +step "Start postgres cluster" +sudo -u postgres pg_ctlcluster 17 main start + +for BIN in $ITEMS; do + step "$BIN version:" + $BIN --version +done + +for USER in $ITEMS; do + step "$USER user:" + id $USER +done + +step "Run dbconfig" +libeufin-dbconfig -r -b testbench/conf/mini.conf -n testbench/conf/mini.conf + +for USER in $ITEMS; do + step "Check $USER db access" + sudo -u $USER psql -d libeufincheck -c "SELECT 1;" &> /dev/null +done + +step "Check man pages" +for BIN in $ITEMS; do + man $BIN > /dev/null + man $BIN.conf > /dev/null +done + +step "Remove libeufin" +dpkg --remove libeufin* + +step "Reinstall libeufin" +dpkg -i ../libeufin*.deb + +step "Purge libeufin:" +dpkg --purge libeufin* + +step "Reinstall libeufin" +dpkg -i ../libeufin*.deb +\ No newline at end of file diff --git a/contrib/ci/jobs/4-deb/job.sh b/contrib/ci/jobs/4-deb/job.sh @@ -10,7 +10,7 @@ echo "Building package version ${VERSION}" make deb # Test package -./contrib/ci/jobs/4-deb/test.sh +sudo ./contrib/ci/deb-test.sh # Move to artifact ls -alh ../*.deb diff --git a/contrib/ci/jobs/4-deb/test.sh b/contrib/ci/jobs/4-deb/test.sh @@ -1,45 +0,0 @@ -set -eu - -ARCH=$(dpkg --print-architecture) - -function step() { - echo -e "\n$@" >&2 -} - -USERS="libeufin-bank libeufin-nexus" - -step "Install" -dpkg -i ../*.deb - -step "Install again" -dpkg -i ../*.deb - -step "Start postgres cluster" -sudo -u postgres pg_ctlcluster 17 main start - -step "versions version" -libeufin-bank --version -libeufin-nexus --version - -for USER in $USERS; do - step "$USER user:" - id $USER -done - -step "Check man pages" -man libeufin-bank > /dev/null -man libeufin-bank.conf > /dev/null -man libeufin-nexus > /dev/null -man libeufin-nexus.conf > /dev/null - -step "Remove" -dpkg --remove libeufin-bank libeufin-nexus - -step "Reinstall" -dpkg -i ../*.deb - -step "Purge:" -dpkg --purge libeufin-bank libeufin-nexus - -step "Reinstall" -dpkg -i ../*.deb -\ No newline at end of file diff --git a/contrib/libeufin-dbconfig b/contrib/libeufin-dbconfig @@ -1,6 +1,6 @@ #!/bin/bash # This file is part of GNU TALER. -# Copyright (C) 2023-2024 Taler Systems SA +# Copyright (C) 2023,2024,2025 Taler Systems SA # # TALER is free software; you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free Software @@ -65,7 +65,7 @@ EOF while true; do case "$1" in -b | --bank-config) - BANK_CFGFILE="$1" + BANK_CFGFILE="$2" shift 2 ;; -h | --help) @@ -81,7 +81,7 @@ while true; do shift ;; -n | --nexus-config) - NEXUS_CFGFILE="$1" + NEXUS_CFGFILE="$2" shift 2 ;; -p | --permissions) @@ -160,18 +160,18 @@ if [ 0 = "$SKIP_NEXUS" ]; then create_db_user "$NEXUS_DBUSER"; fi # Check database name function get_db_name { - if ! echo "$1" | grep "postgres://" >/dev/null; then + if ! echo "$1" | grep "\(postgres\|postgresql\)://" >/dev/null; then exit_fail "Invalid libeufin-$2 database configuration value '$1'." fi # Remove URI, host and query from postgres URI. - echo "$1" | sed -e 's|postgres://.*/||' -e 's|?.*||' + echo "$1" | sed -e 's|.*://.*/||' -e 's|?.*||' } if [ 0 = "$SKIP_BANK" ]; then - BANK_DBNAME=$(get_db_name "$(libeufin-bank config get libeufin-bankdb-postgres CONFIG)" "bank") + BANK_DBNAME=$(get_db_name "$(libeufin-bank config get -c "$BANK_CFGFILE" libeufin-bankdb-postgres CONFIG)" "bank") fi if [ 0 = "$SKIP_NEXUS" ]; then - NEXUS_DBNAME=$(get_db_name "$(libeufin-nexus config get nexus-postgres CONFIG 2>/dev/null || libeufin-nexus config get libeufin-nexusdb-postgres CONFIG)" "nexus") + NEXUS_DBNAME=$(get_db_name "$(libeufin-nexus config get -c "$NEXUS_CFGFILE" nexus-postgres CONFIG 2>/dev/null || libeufin-nexus config get -c "$NEXUS_CFGFILE" libeufin-nexusdb-postgres CONFIG)" "nexus") fi # If using both components they must use the same database @@ -209,8 +209,6 @@ if [ 1 = "$DO_CREATE" ]; then fi fi -# TODO: add a command to only init the _v schema for a simpler init logic - function grant_db_access { if ! echo "GRANT ALL PRIVILEGES ON DATABASE $DBNAME TO \"$1\"" | sudo -i -u postgres psql "$DBNAME"; then @@ -218,7 +216,7 @@ function grant_db_access { fi } function grant_schema_access { - if ! echo "GRANT USAGE ON SCHEMA $2 TO \"$1\"" | + if ! echo "GRANT ALL ON SCHEMA $2 TO \"$1\"" | sudo -i -u postgres psql "$DBNAME"; then exit_fail "Failed to grant usage privilege on schema '$2' to '$1'." fi