summaryrefslogtreecommitdiffstats
path: root/testapi/docker/prepare-env.sh
blob: a1b01bd59312913665db8fb1068fe8580cf177a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
FILE=/etc/opnfv_testapi/config.ini


[[ "${mongodb_url}" == "" ]] && mongodb_url=mongodb://mongo:27017/
[[ "${base_url}" == "" ]] && base_url=http://localhost:8000
[[ ! "${auth}" =~ [f|F]alse ]] && auth=true

auth_server=`echo ${auth:0:1} | tr '[:lower:]' '[:upper:]'``echo ${auth:1} | tr '[:upper:]' '[:lower:]'`
auth_web=`echo ${auth} | tr '[:upper:]' '[:lower:]'`
sudo crudini --set --existing ${FILE} mongo url ${mongodb_url}
sudo crudini --set --existing ${FILE} api url ${base_url}/api/v1
sudo crudini --set --existing ${FILE} ui url ${base_url}
sudo crudini --set --existing ${FILE} api authenticate ${auth_server}

sudo cat > /usr/local/share/opnfv_testapi/testapi-ui/config.json << EOF
{
  "testapiApiUrl": "${base_url}/api/v1",
  "authenticate": ${auth_web}
}
EOF