1
0
Fork 0
mirror of https://github.com/vbatts/imgsrv.git synced 2024-12-02 13:05:40 +00:00
imgsrv/run.sh
Vincent Batts 00628d75f5
run.sh: allow for additional args through env variable
"what could possibly go wrong"

But since changing the cmd through openshift is not straight forward,
this allows me to inject additional parameters to the app.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-08 14:52:25 -04:00

24 lines
574 B
Bash

#!/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}