summaryrefslogtreecommitdiff
path: root/contrib/taler-bank-manage-testing
blob: 29494e3adc681b80fa3b0f6fb824369b57dea98b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/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

if [ "$#" -ne 3 ];
then
    echo "illegal number of parameters"
    exit 1
fi

# Ensure starting accounts exist
taler-bank-manage -c $1 --with-db $2 django provide_accounts
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

# 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


# 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
exec taler-bank-manage -c $1 --with-db $2 $3