2017-06-07 22:49:51 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
binary=${APP_BINARY:-/usr/local/bin/imgsrv}
|
|
|
|
MONGODB_SERVICE_HOST=${MONGODB_SERVICE_HOST:-localhost}
|
|
|
|
MONGODB_SERVICE_PORT=${MONGODB_SERVICE_PORT:-27017}
|
|
|
|
|
2017-06-08 18:52:25 +00:00
|
|
|
args=${ARGS:-""}
|
|
|
|
if [ ! -z "${MONGODB_USER}" ] ; then
|
|
|
|
args=" ${args} -mongo-username=$MONGODB_USER "
|
2017-06-07 22:49:51 +00:00
|
|
|
fi
|
|
|
|
|
2017-06-08 18:52:25 +00:00
|
|
|
if [ ! -z "${MONGODB_PASSWORD}" ] ; then
|
|
|
|
args=" ${args} -mongo-password=$MONGODB_PASSWORD "
|
2017-06-07 22:49:51 +00:00
|
|
|
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}
|