[ADD] New parameter: UPLOAD_DIR. To permit user to define in which

directory uploaded files would be.
This commit is contained in:
Olivier DOSSMANN 2016-03-08 15:50:43 +01:00
parent 4e31ec2e4a
commit 51d43b30d2
2 changed files with 5 additions and 1 deletions

View File

@ -21,3 +21,4 @@ GIT_BRANCH="restful"
GISSMO_VERSION="1.5"
# GISSMO_DOCKER_NAME="gissmo"
GISSMO_DOCKER_PORT="8002"
UPLOAD_DIR="${HOME}/gissmo_project/gissmo/upload"

View File

@ -290,6 +290,9 @@ test_initial_start() {
if ! test -f "$DOCKERFILE"; then
error_and_quit "Docker file don't exists: ${DOCKERFILE}"
fi
if test -z "$UPLOAD_DIR"; then
error_and_quit "No Gissmo upload directory given (UPLOAD_DIR in config file)."
fi
# Build Gissmo Docker images if missing
if [[ "$($docker_cmd images -q gissmo:${GISSMO_VERSION} 2> /dev/null)" == "" ]]; then
cd "$GISSMO_DIR"
@ -319,7 +322,7 @@ start() {
# Run existing Docker container, otherwise create a new one
GISSMO_RUNNING=$($docker_cmd inspect --format="{{ .State.Running }}" ${GISSMO_DOCKER_NAME} 2> /dev/null)
if [ $? -eq 1 ]; then
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -e SECRET_KEY="abcdefg" --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} $ARGS || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -e SECRET_KEY="abcdefg" --name ${GISSMO_DOCKER_NAME} -v ${UPLOAD_DIR}:/opt/gissmo/upload gissmo:${GISSMO_VERSION} $ARGS || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
else
error_and_quit "${GISSMO_DOCKER_NAME} is already launched! If you need
another name please set GISSMO_DOCKER_NAME in configuration file."