2019-12-23 11:47:16 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# This file is in the public domain
|
|
|
|
# Wrapper around 'taler-bank-manage' to first configure the required
|
|
|
|
# testing accounts before launching the bank properly.
|
|
|
|
#
|
|
|
|
# Takes 3 arguments:
|
|
|
|
# $1: the configuration file name
|
|
|
|
# $2: the database name
|
|
|
|
# $3: serve-http or serve-uwsgi
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2020-02-04 22:37:49 +01:00
|
|
|
if [ "$#" -ne 3 ];
|
|
|
|
then
|
|
|
|
echo "illegal number of parameters"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-12-23 12:32:37 +01:00
|
|
|
# Ensure starting accounts exist
|
2019-12-23 11:47:16 +01:00
|
|
|
taler-bank-manage -c $1 --with-db $2 django provide_accounts
|
2020-01-17 15:03:19 +01:00
|
|
|
taler-bank-manage -c $1 --with-db $2 django add_bank_account 42
|
|
|
|
taler-bank-manage -c $1 --with-db $2 django add_bank_account 43
|
2019-12-23 11:47:16 +01:00
|
|
|
|
|
|
|
# This is 'x' hashed by Django
|
|
|
|
PW_HASH='pbkdf2_sha256$180000$RBYjEO0WzE1z$x2Avt35TkOL2pMHvts3B1U1NIJalXZf95WnJhGFOAUs='
|
|
|
|
|
|
|
|
# hack password hash directly into the database:
|
|
|
|
echo "UPDATE auth_user SET password='$PW_HASH'" | psql -Aqt $2
|
|
|
|
|
2019-12-23 12:28:15 +01:00
|
|
|
|
2019-12-23 11:47:16 +01:00
|
|
|
# Note that calling
|
|
|
|
# taler-bank-manage -c $1 --with-db $2 django changepassword Bank x
|
|
|
|
# does not work: (1) it always insists on going interactive, and (2)
|
|
|
|
# rejects 'x' as a password.
|
|
|
|
|
|
|
|
|
|
|
|
# Now run Django for good
|
2019-12-23 12:13:10 +01:00
|
|
|
exec taler-bank-manage -c $1 --with-db $2 $3
|