dk: PROFILE est exporté
This commit is contained in:
parent
434a87019f
commit
a9004fa1d2
34
dk
34
dk
|
@ -57,12 +57,12 @@ function docker_parse_build_args() {
|
||||||
function docker_parse_env_args() {
|
function docker_parse_env_args() {
|
||||||
[ -f .build.env ] && eval "$(docker_parse_build_args .build.env)"
|
[ -f .build.env ] && eval "$(docker_parse_build_args .build.env)"
|
||||||
[ -f build.env ] && eval "$(docker_parse_build_args build.env)"
|
[ -f build.env ] && eval "$(docker_parse_build_args build.env)"
|
||||||
[ -n "$profile" -a -f ".build.$profile.env" ] && eval "$(docker_parse_build_args ".build.$profile.env")"
|
[ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && eval "$(docker_parse_build_args ".build.$PROFILE.env")"
|
||||||
}
|
}
|
||||||
function docker_set_env_args() {
|
function docker_set_env_args() {
|
||||||
[ -f .build.env ] && source ./.build.env
|
[ -f .build.env ] && source ./.build.env
|
||||||
[ -f build.env ] && source ./build.env
|
[ -f build.env ] && source ./build.env
|
||||||
[ -n "$profile" -a -f ".build.$profile.env" ] && source "./.build.$profile.env"
|
[ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && source "./.build.$PROFILE.env"
|
||||||
}
|
}
|
||||||
function docker_set_run_args() {
|
function docker_set_run_args() {
|
||||||
replace_run_args+=(--env-file "$1")
|
replace_run_args+=(--env-file "$1")
|
||||||
|
@ -82,14 +82,14 @@ function compose_set_env_args() {
|
||||||
fi
|
fi
|
||||||
local PROJECT_NAME=--none--
|
local PROJECT_NAME=--none--
|
||||||
[ -f .compose.env ] && source ./.compose.env
|
[ -f .compose.env ] && source ./.compose.env
|
||||||
if [ -n "$profile" ]; then
|
if [ -n "$PROFILE" ]; then
|
||||||
if [ -f "docker-compose.$profile.yml" ]; then
|
if [ -f "docker-compose.$PROFILE.yml" ]; then
|
||||||
replace_env_args+=(-f "docker-compose.$profile.yml")
|
replace_env_args+=(-f "docker-compose.$PROFILE.yml")
|
||||||
fi
|
fi
|
||||||
if [ "$PROJECT_NAME" != --none-- ]; then
|
if [ "$PROJECT_NAME" != --none-- ]; then
|
||||||
if [ -z "$COMPOSE_PROJECT_NAME" ]; then
|
if [ -z "$COMPOSE_PROJECT_NAME" ]; then
|
||||||
[ -n "$PROJECT_NAME" ] || PROJECT_NAME="$(basename -- "$(pwd)")"
|
[ -n "$PROJECT_NAME" ] || PROJECT_NAME="$(basename -- "$(pwd)")"
|
||||||
COMPOSE_PROJECT_NAME="${PROJECT_NAME}_${profile}"
|
COMPOSE_PROJECT_NAME="${PROJECT_NAME}_${PROFILE}"
|
||||||
fi
|
fi
|
||||||
export COMPOSE_PROJECT_NAME
|
export COMPOSE_PROJECT_NAME
|
||||||
fi
|
fi
|
||||||
|
@ -281,21 +281,21 @@ function auto_down() {
|
||||||
DEFAULT_PROFILE=devel
|
DEFAULT_PROFILE=devel
|
||||||
PROFILE=
|
PROFILE=
|
||||||
set_defaults dk
|
set_defaults dk
|
||||||
|
export PROFILE
|
||||||
|
|
||||||
chdir=
|
chdir=
|
||||||
profile="$PROFILE"
|
|
||||||
args=(
|
args=(
|
||||||
--help '$exit_with display_help'
|
--help '$exit_with display_help'
|
||||||
-d:,--chdir: chdir=
|
-d:,--chdir: chdir=
|
||||||
-p:,--profile: profile=
|
-p:,--profile: PROFILE=
|
||||||
-P,--prod profile=prod
|
-P,--prod PROFILE=prod
|
||||||
-T,--test profile=test
|
-T,--test PROFILE=test
|
||||||
)
|
)
|
||||||
parse_args "$@"; set -- "${args[@]}"
|
parse_args "$@"; set -- "${args[@]}"
|
||||||
|
|
||||||
# construire par défaut
|
# construire par défaut
|
||||||
[ $# -eq 0 ] && set -- build
|
[ $# -eq 0 ] && set -- build
|
||||||
[ -n "$profile" ] || profile="$DEFAULT_PROFILE"
|
[ -n "$PROFILE" ] || PROFILE="$DEFAULT_PROFILE"
|
||||||
|
|
||||||
[ -n "$chdir" ] && { cd "$chdir" || die; }
|
[ -n "$chdir" ] && { cd "$chdir" || die; }
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_build "${args[@]}" || die
|
auto_build "${args[@]}" || die
|
||||||
;;
|
;;
|
||||||
push)
|
push)
|
||||||
|
@ -320,7 +320,7 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_push "${args[@]}" || die
|
auto_push "${args[@]}" || die
|
||||||
;;
|
;;
|
||||||
s|run|start)
|
s|run|start)
|
||||||
|
@ -328,11 +328,11 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_up "${args[@]}" || die
|
auto_up "${args[@]}" || die
|
||||||
;;
|
;;
|
||||||
k|stop)
|
k|stop)
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_stop || die
|
auto_stop || die
|
||||||
;;
|
;;
|
||||||
1|up)
|
1|up)
|
||||||
|
@ -340,7 +340,7 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_up "${args[@]}" && auto_logs || die
|
auto_up "${args[@]}" && auto_logs || die
|
||||||
;;
|
;;
|
||||||
l|logs) auto_logs || die;;
|
l|logs) auto_logs || die;;
|
||||||
|
@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
if auto_build; then
|
if auto_build; then
|
||||||
auto_up "${args[@]}" && auto_logs || die
|
auto_up "${args[@]}" && auto_logs || die
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue