dk: par défaut, les suffixes courants sont supprimés
This commit is contained in:
parent
9fad9924ef
commit
74190f7264
9
dk
9
dk
|
@ -420,11 +420,18 @@ function docker_check_name() {
|
|||
}
|
||||
|
||||
function compose_set_project_name() {
|
||||
local PROJECT_NAME= PROJECT_NAME_REMOVE_SUFFIX=.service PROJECT_NAME_ADD_PROFILE=
|
||||
local PROJECT_NAME= PROJECT_NAME_REMOVE_SUFFIX=--defaults-- PROJECT_NAME_ADD_PROFILE=
|
||||
[ -f .compose.env ] && source ./.compose.env
|
||||
|
||||
[ -n "$PROJECT_NAME" ] || PROJECT_NAME="$(basename -- "$(pwd)")"
|
||||
if [ "$PROJECT_NAME_REMOVE_SUFFIX" == --defaults-- ]; then
|
||||
if [ "${PROJECT_NAME%.service}" != "$PROJECT_NAME" ]; then PROJECT_NAME="${PROJECT_NAME%.service}"
|
||||
elif [ "${PROJECT_NAME%.stack}" != "$PROJECT_NAME" ]; then PROJECT_NAME="${PROJECT_NAME%.stack}"
|
||||
elif [ "${PROJECT_NAME%.network}" != "$PROJECT_NAME" ]; then PROJECT_NAME="${PROJECT_NAME%.network}"
|
||||
fi
|
||||
else
|
||||
PROJECT_NAME="${PROJECT_NAME%$PROJECT_NAME_REMOVE_SUFFIX}"
|
||||
fi
|
||||
|
||||
if [ -n "$PROFILE" ]; then
|
||||
[ -n "$COMPOSE_PROJECT_NAME" ] || COMPOSE_PROJECT_NAME="$PROJECT_NAME${PROJECT_NAME_ADD_PROFILE:+_${PROFILE}}"
|
||||
|
|
Loading…
Reference in New Issue