UNPKG

791 Bapplication/x-shView Raw
1#!/bin/sh
2set -e
3
4cp /opt/shinobi/conf.sample.json /opt/shinobi/conf.json
5cp /opt/shinobi/super.sample.json /opt/shinobi/super.json
6cp /opt/shinobi/plugins/motion/conf.sample.json /opt/shinobi/plugins/motion/conf.json
7
8ADMIN_PASSWORD_MD5=$(echo -n "${ADMIN_PASSWORD}" | md5sum | sed -e 's/ -$//')
9
10#set config data from variables
11sed -i -e 's/"user": "majesticflame"/"user": "'"${MYSQL_USER}"'"/g' \
12 -e 's/"password": ""/"password": "'"${MYSQL_PASSWORD}"'"/g' \
13 -e 's/"host": "127.0.0.1"/"host": "'"${MYSQL_HOST}"'"/g' \
14 -e 's/"database": "ccio"/"database": "'"${MYSQL_DATABASE}"'"/g' \
15 "/opt/shinobi/conf.json"
16# Set the admin password
17sed -i -e "s/21232f297a57a5a743894a0e4a801fc3/${ADMIN_PASSWORD_MD5}/" "/opt/shinobi/super.json"
18
19# Execute Command
20exec "$@"