Transformer en template docker-stack-template avec .env.example

- Ajout .env.example : variables Docker Compose
- docker-compose.yml : mots de passe variabilises
- Scripts : chargement de config a 2 niveaux (global + per-app)
- docker-scripts.conf : renomme docker-stack-template
- URLs mises a jour dans setup, install_cron, README
This commit is contained in:
2026-06-26 16:07:02 -04:00
parent 0fc2b8d0d6
commit a2e466c074
9 changed files with 118 additions and 51 deletions
+17 -4
View File
@@ -14,17 +14,30 @@
set -euo pipefail
# ─── Charger la configuration commune ─────────────────────────────────────────
# ─── Charger la configuration ────────────────────────────────────────────────
# Ordre : 1) config globale (template) → 2) config spécifique à l'app (surcharge)
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
CONFIG_FILE="${CONFIG_FILE:-$SCRIPT_DIR/docker-scripts.conf}"
if [[ -f "$CONFIG_FILE" ]]; then
GLOBAL_CONFIG="${SCRIPT_DIR}/docker-scripts.conf"
if [[ -f "$GLOBAL_CONFIG" ]]; then
# shellcheck source=/dev/null
source "$CONFIG_FILE"
source "$GLOBAL_CONFIG"
fi
# ─── Nom de l'application (défaut si pas dans la config) ─────────────────────
DOCKER_APP_NAME="${DOCKER_APP_NAME:-gitea}"
# ─── Configuration locale (après chargement global, permet surcharge env) ────
COMPOSE_DIR="${COMPOSE_DIR:-/srv/docker/$DOCKER_APP_NAME}"
COMPOSE_FILE="${COMPOSE_FILE:-docker-compose.yml}"
# Charger la config spécifique à l'application (surcharge la config globale)
APP_CONFIG="${COMPOSE_DIR}/docker-scripts.conf"
if [[ -f "$APP_CONFIG" ]] && [[ "$APP_CONFIG" != "$GLOBAL_CONFIG" ]]; then
# shellcheck source=/dev/null
source "$APP_CONFIG"
fi
# ─── Couleurs ───────────────────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; CYAN='\033[0;36m'; NC='\033[0m'
ok() { echo -e " ${GREEN}✅${NC} $1"; }