f47b54f50f930bf33afee7c14456dabc0ad4713e
[vfc/gvnfm/vnfres.git] / res / docker / instance_config.sh
1 #!/bin/bash
2
3 MSB_IP=`echo $MSB_ADDR | cut -d: -f 1`
4 MSB_PORT=`echo $MSB_ADDR | cut -d: -f 2`
5
6 if [ $MSB_IP ]; then
7     sed -i "s|MSB_SERVICE_IP.*|MSB_SERVICE_IP = '$MSB_IP'|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
8 fi
9
10 if [ $MSB_PORT ]; then
11     sed -i "s|MSB_SERVICE_PORT.*|MSB_SERVICE_PORT = '$MSB_PORT'|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
12 fi
13
14 if [ $SERVICE_IP ]; then
15     sed -i "s|\"ip\": \".*\"|\"ip\": \"$SERVICE_IP\"|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
16 fi
17
18 # Configure MYSQL
19 MYSQL_IP=`echo $MYSQL_ADDR | cut -d: -f 1`
20 MYSQL_PORT=`echo $MYSQL_ADDR | cut -d: -f 2`
21 echo "MYSQL_ADDR=$MYSQL_ADDR"
22
23 MYSQL_USER=`echo $MYSQL_AUTH | cut -d: -f 1`
24 MYSQL_ROOT_PASSWORD=`echo $MYSQL_AUTH | cut -d: -f 2`
25 #redis
26 REDIS_IP=`echo $REDIS_ADDR | cut -d: -f 1`
27 REDIS_PORT=`echo $REDIS_ADDR | cut -d: -f 2`
28
29 sed -i "s|DB_IP.*|DB_IP = '$MYSQL_IP'|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
30 sed -i "s|DB_PORT.*|DB_PORT = $MYSQL_PORT|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
31 #redis
32 sed -i "s|REDIS_HOST.*|REDIS_HOST = '$REDIS_IP'|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
33 sed -i "s|REDIS_PORT.*|REDIS_PORT = '$REDIS_PORT'|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
34
35 sed -i "s|DB_USER.*|DB_USER = '$MYSQL_USER'|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
36 sed -i "s|DB_PASSWD.*|DB_PASSWD = '$MYSQL_ROOT_PASSWORD'|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
37
38 cat vfc/gvnfm/vnfres/res/res/pub/config/config.py