From 4f7cb900d2cd1f0aeaa582f2e575cd3c5bb96c81 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 9 Oct 2018 19:12:07 +0400 Subject: [PATCH] dk: support de .compose.env pour le nom du projet --- dk | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dk b/dk index 37f789d..5a53109 100755 --- a/dk +++ b/dk @@ -80,8 +80,19 @@ function compose_set_env_args() { if [ -f docker-compose.override.yml ]; then replace_env_args+=(-f docker-compose.override.yml) fi - if [ -n "$profile" -a -f "docker-compose.$profile.yml" ]; then - replace_env_args+=(-f "docker-compose.$profile.yml") + local PROJECT_NAME=--none-- + [ -f .compose.env ] && source ./.compose.env + if [ -n "$profile" ]; then + if [ -f "docker-compose.$profile.yml" ]; then + replace_env_args+=(-f "docker-compose.$profile.yml") + fi + if [ "$PROJECT_NAME" != --none-- ]; then + if [ -z "$COMPOSE_PROJECT_NAME" ]; then + [ -n "$PROJECT_NAME" ] || PROJECT_NAME="$(basename -- "$(pwd)")" + COMPOSE_PROJECT_NAME="${PROJECT_NAME}_${profile}" + fi + export COMPOSE_PROJECT_NAME + fi fi }