Skip to content

Commit

Permalink
prevent globing and word splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrkwiecinski committed Nov 10, 2023
1 parent aef9ba7 commit c8621f7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions compose/bin/docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ else
DOCKER_COMPOSE="docker-compose"
fi

COMPOSE_FILES_LIST=("compose.yaml" "compose.healthcheck.yaml")
COMPOSE_FILES=("compose.yaml" "compose.healthcheck.yaml")

if [ "$1" == "--no-dev" ]; then
# ensure --no-dev parameter isn't passed to docker compose
shift 1
else
COMPOSE_FILES_LIST+=("compose.dev.yaml")
COMPOSE_FILES+=("compose.dev.yaml")
fi

# Combine files, prefix each with -f
COMPOSE_FILES="${COMPOSE_FILES_LIST[@]/#/'-f '}"
COMPOSE_FILES_PREFIXED=()

${DOCKER_COMPOSE} ${COMPOSE_FILES} "$@"
for file in "${COMPOSE_FILES[@]}"; do
COMPOSE_FILES_PREFIXED+=("-f" "$file")
done

${DOCKER_COMPOSE} "${COMPOSE_FILES_PREFIXED[@]}" "$@"

0 comments on commit c8621f7

Please sign in to comment.