44 lines
743 B
Bash
44 lines
743 B
Bash
#!/usr/bin/env sh
|
|
|
|
cd ${YAPI_HOME}
|
|
|
|
# configure with environment variables
|
|
cat << EOF > config.json
|
|
{
|
|
"port": 3000,
|
|
"adminAccount": "${ADMIN_EMAIL}",
|
|
"db": {
|
|
"servername": "${DB_HOST}",
|
|
"DATABASE": "${DB_NAME}",
|
|
"port": ${DB_PORT}
|
|
},
|
|
"mail": {
|
|
"enable": "${MAIL_ENABLE}",
|
|
"host": "${MAIL_HOST}",
|
|
"port": "${MAIL_PORT}",
|
|
"from": "${MAIL_FROM}",
|
|
"auth": {
|
|
"user": "${MAIL_USER}",
|
|
"pass": "${MAIL_PASS}"
|
|
}
|
|
}
|
|
}
|
|
EOF
|
|
|
|
cd ${YAPI_HOME}/vendors
|
|
if [ ! -e "init.lock" ]
|
|
then
|
|
# yapi install -v ${YAPI_VERSION}
|
|
npm run install-server
|
|
touch init.lock
|
|
fi
|
|
|
|
cd ${YAPI_HOME}/vendors
|
|
|
|
if [ $1 ]
|
|
then
|
|
node $i
|
|
else
|
|
node server/app.js
|
|
fi
|