Browse Source

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

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
cache-relation
Valentin Lab 5 years ago
parent
commit
64ffcf466b
  1. 54
      bin/compose

54
bin/compose

@ -921,24 +921,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
@ -955,8 +941,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 < \
@ -1006,4 +1013,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