commit 260fae24471ab727a2545d9922be6c2ffef3e0aa
parent a0450c3fb3f9720fd3db57e9b21e4d2507a303fc
Author: MS <ms@taler.net>
Date: Thu, 30 Nov 2023 13:38:43 +0100
netzbon currency config
Diffstat:
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/netzbon/config_libeufin_bank.sh b/netzbon/config_libeufin_bank.sh
@@ -45,14 +45,29 @@ fi
# TODO: add sanity-checks for presence of other required env-vars
say "Configure the bank with ${CURRENCY}..."
+
# TODO is 20000000 big enough for admin dbt limit
-echo -e "[libeufin-bank]\n" \
- "CURRENCY=${CURRENCY}\n"\
- "DEFAULT_EXCHANGE=${PROTO}://exchange.$DOMAIN_NAME\n"\
- "DEFAULT_ADMIN_DEBT_LIMIT=${CURRENCY}:20000000\n"\
- "SERVE=tcp\n"\
- "PORT=$BANK_PORT\n"\
- >> /etc/libeufin/libeufin-bank.conf
+cat << EOF >> /etc/libeufin/libeufin-bank.conf
+[libeufin-bank]
+CURRENCY=${CURRENCY}
+DEFAULT_EXCHANGE=${PROTO}://exchange.${DOMAIN_NAME}
+DEFAULT_ADMIN_DEBT_LIMIT=${CURRENCY}:20000000
+SERVE=tcp
+PORT=${BANK_PORT}
+EOF
+
+if ! taler-config -s "currency-$CURRENCY" -o code &> /dev/null
+then cat << EOF >> /etc/libeufin/libeufin-bank.conf
+[currency-netzbon]
+ENABLED = YES
+name = "NetzBon"
+code = "NETZBON"
+fractional_input_digits = 2
+fractional_normal_digits = 2
+fractional_trailing_zero_digits = 2
+alt_unit_names = {"0":"NETZBON"}
+EOF
+fi
say "Setting up libeufin-bank database"
libeufin-bank-dbconfig
@@ -97,4 +112,4 @@ EXCHANGE_WIRE_GATEWAY_URL="${PROTO}://bank.$DOMAIN_NAME/accounts/exchange/taler-
# Communicating this to the exchange script, as the exchange
# needs these for the /keys response.
echo "EXCHANGE_PAYTO=\"${EXCHANGE_PAYTO}\"" >> config/internal.conf
-echo "EXCHANGE_WIRE_GATEWAY_URL=\"${EXCHANGE_WIRE_GATEWAY_URL}\"" >> config/internal.conf
-\ No newline at end of file
+echo "EXCHANGE_WIRE_GATEWAY_URL=\"${EXCHANGE_WIRE_GATEWAY_URL}\"" >> config/internal.conf
diff --git a/netzbon/main.sh b/netzbon/main.sh
@@ -27,7 +27,7 @@ say "All configuration values asked during the setup script"
say "can be changed in config/user.conf"
if test -z "${CURRENCY:-}"; then
- read -r -p "Enter the name of the currency (e.g. 'EUR'): " CURRENCY
+ read -r -p "Enter the name of the currency (e.g. 'NETZBON'): " CURRENCY
# convert to all-caps
CURRENCY=$(echo "${CURRENCY}" | tr a-z A-Z)
# libeufin currenly doesn't like currency names less than 3 letters.