2017-04-30 22:13:12 +08:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
2018-06-06 11:43:25 +08:00
|
|
|
cd /mindoc/
|
2017-04-30 22:13:12 +08:00
|
|
|
|
2018-06-06 11:43:25 +08:00
|
|
|
if [ ! -f "/mindoc/conf/app.conf" ] ; then
|
|
|
|
cp /mindoc/conf/app.conf.example /mindoc/conf/app.conf
|
2018-02-03 17:38:21 +08:00
|
|
|
sed -i "s#^db_adapter=.*#db_adapter=sqlite3#g" conf/app.conf
|
|
|
|
sed -i "s#^db_database.*#db_database=./database/mindoc.db#g" conf/app.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z $DB_ADAPTER ]; then
|
|
|
|
sed -i "s#^db_adapter=.*#db_adapter=${DB_ADAPTER}#g" conf/app.conf
|
2017-04-30 22:13:12 +08:00
|
|
|
fi
|
|
|
|
|
2017-05-01 14:10:39 +08:00
|
|
|
if [ ! -z $MYSQL_PORT_3306_TCP_ADDR ] ; then
|
|
|
|
sed -i 's/^db_host.*/db_host='$MYSQL_PORT_3306_TCP_ADDR'/g' conf/app.conf
|
2017-04-30 22:13:12 +08:00
|
|
|
fi
|
|
|
|
|
2017-05-01 14:10:39 +08:00
|
|
|
if [ ! -z $MYSQL_PORT_3306_TCP_PORT ] ; then
|
|
|
|
sed -i 's/^db_port.*/db_port='$MYSQL_PORT_3306_TCP_PORT'/g' conf/app.conf
|
2017-04-30 22:13:12 +08:00
|
|
|
fi
|
|
|
|
|
2017-05-01 14:10:39 +08:00
|
|
|
if [ ! -z $MYSQL_INSTANCE_NAME ] ; then
|
2018-02-03 17:38:21 +08:00
|
|
|
sed -i "s#^db_database.*#db_database=${MYSQL_INSTANCE_NAME}#g" conf/app.conf
|
2017-04-30 22:13:12 +08:00
|
|
|
fi
|
|
|
|
|
2017-05-01 14:10:39 +08:00
|
|
|
if [ ! -z $MYSQL_USERNAME ] ; then
|
|
|
|
sed -i 's/^db_username.*/db_username='$MYSQL_USERNAME'/g' conf/app.conf
|
2017-04-30 22:13:12 +08:00
|
|
|
fi
|
|
|
|
|
2017-05-01 14:10:39 +08:00
|
|
|
if [ ! -z $MYSQL_PASSWORD ] ; then
|
|
|
|
sed -i 's/^db_password.*/db_password='$MYSQL_PASSWORD'/g' conf/app.conf
|
2017-04-30 22:13:12 +08:00
|
|
|
fi
|
|
|
|
|
2017-05-15 16:19:59 +08:00
|
|
|
if [ ! -z $HTTP_PORT ] ; then
|
2018-02-03 17:38:21 +08:00
|
|
|
sed -i 's/^httpport.*/httpport='$HTTP_PORT'/g' conf/app.conf
|
2017-04-30 22:13:12 +08:00
|
|
|
fi
|
|
|
|
|
2017-05-15 16:19:59 +08:00
|
|
|
if [ ! -z $CDNJS ]; then
|
2018-02-03 17:38:21 +08:00
|
|
|
sed -i "s#^cdnjs=.*#cdnjs=$CDNJS#g" conf/app.conf
|
|
|
|
fi
|
|
|
|
if [ ! -z $CDNIMG ]; then
|
|
|
|
sed -i "s#^cdnimg=.*#cdnimg=$CDNIMG#g" conf/app.conf
|
2017-05-15 16:19:59 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z $CDNCSS ]; then
|
2018-02-03 17:38:21 +08:00
|
|
|
sed -i "s#^cdncss=.*#cdncss=$CDNCSS#g" conf/app.conf
|
2017-05-15 16:19:59 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z $CDN ]; then
|
2017-05-15 17:56:25 +08:00
|
|
|
sed -i "s#^cdn=.*#cdn=$CDN#g" conf/app.conf
|
2017-05-15 16:19:59 +08:00
|
|
|
fi
|
|
|
|
|
2018-03-01 09:18:59 +08:00
|
|
|
if [ ! -z $CACHE ]; then
|
|
|
|
sed -i "s#cache=.*#cache=$CACHE#g" conf/app.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z $CACHE_PROVIDER ]; then
|
|
|
|
sed -i "s#cache_provider=.*#cache_provider=$CACHE_PROVIDER#g" conf/app.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z $CACHE_MEMCACHE_HOST ]; then
|
|
|
|
sed -i "s#cache_memcache_host=.*#cache_memcache_host=$CACHE_MEMCACHE_HOST#g" conf/app.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z $CACHE_REDIS_HOST ]; then
|
|
|
|
sed -i "s#cache_redis_host=.*#cache_redis_host=$CACHE_REDIS_HOST#g" conf/app.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z $CACHE_REDIS_DB ]; then
|
|
|
|
sed -i "s#cache_redis_db=.*#cache_redis_db=$CACHE_REDIS_DB#g" conf/app.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z $CACHE_REDIS_PASSWROD ]; then
|
|
|
|
sed -i "s#cache_redis_password=.*#cache_redis_password=$CACHE_REDIS_PASSWROD#g" conf/app.conf
|
|
|
|
fi
|
|
|
|
|
2018-03-25 16:39:09 +08:00
|
|
|
if [ ! -z $BASEURL ]; then
|
|
|
|
sed -i "s#baseurl=.*#baseurl=$BASEURL#g" conf/app.conf
|
|
|
|
fi
|
|
|
|
|
2018-07-12 18:44:02 +08:00
|
|
|
if [ ! -z $ENABLE_EXPORT ]; then
|
2018-07-19 13:50:26 +08:00
|
|
|
sed -i "s#enable_export=.*#enable_export=$ENABLE_EXPORT#g" conf/app.conf
|
2018-07-12 18:44:02 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2017-05-04 12:20:40 +08:00
|
|
|
sed -i 's/^runmode.*/runmode=prod/g' conf/app.conf
|
2017-04-30 22:13:12 +08:00
|
|
|
|
2018-06-06 11:43:25 +08:00
|
|
|
/mindoc/mindoc_linux_amd64 install
|
|
|
|
/mindoc/mindoc_linux_amd64
|