diff --git a/config/orgaTmpl/orga-gen.sh b/config/orgaTmpl/orga-gen.sh index 39badbf..a54d1b7 100755 --- a/config/orgaTmpl/orga-gen.sh +++ b/config/orgaTmpl/orga-gen.sh @@ -89,6 +89,7 @@ for ARG in "$@"; do ln -sf ../../config/orgaTmpl/orga-gen.sh ln -sf ../../config/orgaTmpl/orga-rm.sh ln -sf ../../config/orgaTmpl/reload.sh + ln -sf ../../config/orgaTmpl/orga-simplifie-url.sh else printKazError "Name must contains only a-z0-9_\-" usage diff --git a/config/orgaTmpl/orga-simplifie-url.sh b/config/orgaTmpl/orga-simplifie-url.sh new file mode 100755 index 0000000..7e5d53a --- /dev/null +++ b/config/orgaTmpl/orga-simplifie-url.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +#KI: fab +#KOI: créer des url simplifiée sans le suffixe (-wp ou -cloud) +#KAN: 04/06/2026 + +PRG=$(basename $0) +KAZ_ROOT=$(cd "$(dirname $0)/../.."; pwd) +. "${KAZ_ROOT}/bin/.commonFunctions.sh" +setKazVars + +cd $(dirname $0) +ORGA_DIR="$(basename "$(pwd)")" + +usage(){ + echo "Usage: $0 [-h|--help] [+cloud|+wp]" + echo + echo " -h|--help : this help" + echo " +cloud : simplifie l'url du cloud" + echo " +wp : simplifie l'url du wp" +} + +#quelle orga ? +ORGA=${ORGA_DIR%-orga} + +#quel choix ? +MODE="" +for ARG in "$@"; do + case "$ARG" in + -h|--help) + usage + exit 0 + ;; + + +cloud|+wp) + if [ -n "$MODE" ]; then + echo "Une seule option est autorisée : +cloud ou +wp" + exit 1 + fi + MODE="$ARG" + ;; + + *) + echo "Option invalide : $ARG" + usage + exit 1 + ;; + esac +done + + +OVERRIDE_FILE="compose.override.yml" + +# sauvegarde si le fichier existe déjà +if [ -f "$OVERRIDE_FILE" ]; then + cp "$OVERRIDE_FILE" "${OVERRIDE_FILE}.$(date +%Y%m%d-%H%M%S).bak" +fi + +#on récupère toutes les variables utiles +set -a + source .env +set +a + +# quel Traitement ? +case "$MODE" in + + ########################## + +cloud) + echo "TODO: Traitement cloud pour l'orga ${ORGA}" + ;; + + ########################## + +wp) + echo "Traitement wordpress pour l'orga ${ORGA}" + + #creer le compose-override.yml + + cat > "$OVERRIDE_FILE" <