more DRY re: env vars
This commit is contained in:
parent
d6bb268315
commit
c88f29d67c
31
run.sh
31
run.sh
|
@ -37,21 +37,22 @@ run_embark () {
|
||||||
"${EMBARK_DOCKER_MOUNT_SOURCE}:${EMBARK_DOCKER_MOUNT_TARGET}"
|
"${EMBARK_DOCKER_MOUNT_SOURCE}:${EMBARK_DOCKER_MOUNT_TARGET}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if [[ -v LANG ]]; then
|
local env_var
|
||||||
run_opts=( "${run_opts[@]}" "-e" "LANG" )
|
for env_var in LANG \
|
||||||
fi
|
LANGUAGE \
|
||||||
|
LC_ALL \
|
||||||
if [[ -v LANGUAGE ]]; then
|
TERM;
|
||||||
run_opts=( "${run_opts[@]}" "-e" "LANGUAGE" )
|
# do not alter indentation, tabs in lines below
|
||||||
fi
|
do
|
||||||
|
local include_var=$(cat <<- ENV_VAR
|
||||||
if [[ -v LC_ALL ]]; then
|
if [[ -n $env_var && -v $env_var ]]; then
|
||||||
run_opts=( "${run_opts[@]}" "-e" "LC_ALL" )
|
run_opts=( "${run_opts[@]}" "-e" "$env_var" )
|
||||||
fi
|
fi
|
||||||
|
ENV_VAR
|
||||||
if [[ -v TERM ]]; then
|
)
|
||||||
run_opts=( "${run_opts[@]}" "-e" "TERM" )
|
eval "$include_var"
|
||||||
fi
|
done
|
||||||
|
# do not alter indentation, tabs in lines above
|
||||||
|
|
||||||
if [[ $EMBARK_DOCKER_RUN_RM = true ]]; then
|
if [[ $EMBARK_DOCKER_RUN_RM = true ]]; then
|
||||||
run_opts=( "${run_opts[@]}" "--rm" )
|
run_opts=( "${run_opts[@]}" "--rm" )
|
||||||
|
|
Loading…
Reference in New Issue