1
0
Fork 0
mirror of https://github.com/vbatts/imgsrv.git synced 2024-12-03 13:35:40 +00:00
imgsrv/run.sh

25 lines
574 B
Bash
Raw Normal View History

#!/bin/sh
binary=${APP_BINARY:-/usr/local/bin/imgsrv}
MONGODB_SERVICE_HOST=${MONGODB_SERVICE_HOST:-localhost}
MONGODB_SERVICE_PORT=${MONGODB_SERVICE_PORT:-27017}
args=${ARGS:-""}
if [ ! -z "${MONGODB_USER}" ] ; then
args=" ${args} -mongo-username=$MONGODB_USER "
fi
if [ ! -z "${MONGODB_PASSWORD}" ] ; then
args=" ${args} -mongo-password=$MONGODB_PASSWORD "
fi
if ! echo "${1:-$@}" | grep -q '\-mongo-host' ; then
args=" ${args} -mongo-host=$MONGODB_SERVICE_HOST:$MONGODB_SERVICE_PORT "
fi
${binary} \
-server \
-mongo-db=$MONGODB_DATABASE \
${1:-$@} \
${args}