Browse Source

new: add ``SHOW_ENV`` and ``SHOW_CONFIG_LOCATIONS``

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
lokavaluto/dev/master
Valentin Lab 5 years ago
parent
commit
371496e901
  1. 54
      bin/compose

54
bin/compose

@ -916,24 +916,10 @@ mk_docker_run_options() {
mkdir -p "$SESSION_DIR" || return 1
mv -f "$filename" "$src" || return 1
if [ -n "$DEBUG" ]; then
echo "${WHITE}Environment:${NORMAL}"
echo " COMPOSE_DOCKER_IMAGE: $COMPOSE_DOCKER_IMAGE"
echo " CHARM_STORE: $CHARM_STORE"
echo " DATASTORE: $DATASTORE"
echo " CONFIGSTORE: $CONFIGSTORE"
echo " COMPOSE_VAR: $COMPOSE_VAR"
echo " COMPOSE_CACHE: $COMPOSE_CACHE"
echo " COMPOSE_LAUNCHER_CACHE: $COMPOSE_LAUNCHER_CACHE"
echo " SESSION_DIR: $SESSION_DIR"
echo " TZ_PATH: $TZ_PATH"
fi >&2
}
run() {
local os docker_run_opts
load_env() {
docker_run_opts=()
if [ -z "$COMPOSE_LAUNCHER_OPTS" ]; then
mk_docker_run_options "$@" || return 1
@ -950,8 +936,29 @@ run() {
fi
done < <(cat "$COMPOSE_LAUNCHER_OPTS")
fi
}
show_env() {
echo "${WHITE}Environment:${NORMAL}"
echo " COMPOSE_DOCKER_IMAGE: $COMPOSE_DOCKER_IMAGE"
echo " CHARM_STORE: $CHARM_STORE"
echo " DATASTORE: $DATASTORE"
echo " CONFIGSTORE: $CONFIGSTORE"
echo " COMPOSE_VAR: $COMPOSE_VAR"
echo " COMPOSE_CACHE: $COMPOSE_CACHE"
echo " COMPOSE_LAUNCHER_CACHE: $COMPOSE_LAUNCHER_CACHE"
echo " SESSION_DIR: $SESSION_DIR"
echo " TZ_PATH: $TZ_PATH"
}
run() {
local os docker_run_opts
load_env "$@" || return 1
set_os
[ -n "$DEBUG" ] && show_env
set_os || return 1
if [ -n "$ARG_COMPOSE_FILE" ]; then
array_read-0 cmd_args < \
@ -1001,4 +1008,19 @@ depends docker cat readlink sed realpath tee sed grep tail
ansi_color "${ansi_color:-tty}"
if [ "$SHOW_ENV" ]; then
load_env || return 1
show_env
exit 0
fi
if [ "$SHOW_CONFIG_LOCATIONS" ]; then
set_os || return 1
echo "compose will read these files if existing in the given order:"
for loc in "${compose_config_files[@]}"; do
echo " - $loc"
done
exit 0
fi
run "$@"
Loading…
Cancel
Save