summaryrefslogtreecommitdiff
path: root/bin/taler-deployment-config-generate
blob: 640ef6caf70e993f5e89a3941dc1399be6f68378 (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
39
40
41
42
43
44
#!/bin/bash

# Generate the taler configuration based on environment variables.
# These variables are usually defined in $HOME/activate.
# Some configuration files still need to be signed with taler-deployment-config-sign.
# It overwrites previous config files.
#
#

set -eu

base=$HOME

export PATH="$base/deployment":$PATH

if [[ -z ${TALER_CONFIG_ENV+x} ]]; then
  echo "TALER_CONFIG_ENV not set"
  exit 1
fi

if [[ -z ${TALER_CONFIG_CURRENCY+x} ]]; then
  echo "TALER_CONFIG_CURRENCY not set"
  exit 1
fi

if [[ ! -f $HOME/shared-data/exchange/offline-keys/master.priv ]] ; then
  mkdir -p $HOME/shared-data/exchange/offline-keys/
  cp $base/deployment/private-keys/${TALER_CONFIG_ENV}-exchange-master.priv $HOME/shared-data/exchange/offline-keys/master.priv
fi

if [[ ! -f $HOME/shared-data/auditor/offline-keys/auditor.priv ]] ; then
  mkdir -p $HOME/shared-data/auditor/offline-keys/
  cp $base/deployment/private-keys/auditor.priv $HOME/shared-data/auditor/offline-keys/auditor.priv
fi

exchange_pub=$(gnunet-ecc -p $HOME/shared-data/exchange/offline-keys/master.priv)

$HOME/deployment/config/generate-config \
  --exchange-pub "$exchange_pub" \
  --currency "$TALER_CONFIG_CURRENCY" \
  --outdir $HOME/.config \
  --shared-outdir $HOME/shared-data \
  --envname "$TALER_CONFIG_ENV" \
  --standalone "${TALER_CONFIG_STANDALONE:-0}"