#!/bin/sh
#docker exec -i t nginx /usr/share/app/nginx/vip/webapp/evn.sh test
testUrl='http:\/\/192.168.1.100:3000'
trueUrl='https:\/\/vip.menusifu.com:23080'
if [ "$1" = "test" ]
then
echo "$trueUrl"
sed -i "s/$trueUrl/$testUrl/g" /usr/share/app/nginx/vip/webapp/super/js/app.js
sed -i "s/$trueUrl/$testUrl/g" /usr/share/app/nginx/vip/webapp/super/js/app.js
sed -i "s/$trueUrl/$testUrl/g" /usr/share/app/nginx/vip/webapp/index.html
sed -i "s/$trueUrl/$testUrl/g" /usr/share/app/nginx/vip/webapp/index.html
sed -i "s/$trueUrl/$testUrl/g" /usr/share/app/nginx/vip/webapp/admin/index.html
sed -i "s/$trueUrl/$testUrl/g" /usr/share/app/nginx/vip/webapp/admin/index.html
sed -i "s/$trueUrl/$testUrl/g" /usr/share/app/node/vips/routes/admins.js
sed -i "s/$trueUrl/$testUrl/g" /usr/share/app/node/vips/routes/admins.js
else
echo "$testUrl"
sed -i "s/$testUrl/$trueUrl/g" /usr/share/app/nginx/vip/webapp/super/js/app.js
sed -i "s/$testUrl/$trueUrl/g" /usr/share/app/nginx/vip/webapp/super/js/app.js
sed -i "s/$testUrl/$trueUrl/g" /usr/share/app/nginx/vip/webapp/index.html
sed -i "s/$testUrl/$trueUrl/g" /usr/share/app/nginx/vip/webapp/index.html
sed -i "s/$testUrl/$trueUrl/g" /usr/share/app/nginx/vip/webapp/admin/index.html
sed -i "s/$testUrl/$trueUrl/g" /usr/share/app/nginx/vip/webapp/admin/index.html
sed -i "s/$testUrl/$trueUrl/g" /usr/share/app/node/vips/routes/admins.js
sed -i "s/$testUrl/$trueUrl/g" /usr/share/app/node/vips/routes/admins.js
fi
chmod g+w /usr/share/app/nginx/vip/webapp/super/js/app.js
chmod g+w /usr/share/app/node/vips/routes/admins.js
chmod g+w /usr/share/app/nginx/vip/webapp/index.html
chmod g+w /usr/share/app/nginx/vip/webapp/admin/index.html