aboutsummaryrefslogtreecommitdiffhomepage
path: root/docker/backend/applyConfig.sh
blob: f3360b396b19ec678034053251acc1ad7a5d75c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
if [ -f backend-configuration.json ]; then
  echo "waiting for backend..."

  timeout 30 sh -c 'until nc -z $0 $1; do sleep 1; done' localhost 5005

  if [ $? -ne 0 ]; then
    echo "failed to apply config"
    exit 1
  fi

  echo "apply server config"

  wget -qO- --method=PATCH \
    --body-data="`cat backend-configuration.json`" \
    --header='Content-Type:application/json' \
    http://localhost:5005/configuration

  echo "server config applied"
else
  echo "skip backend configuration"
fi