Refactor: Simplify configuration and remove redundant variables
- Remove redundant variables: BACKUP_USER, BACKUP_STORAGE_PATH, BACKUP_REPO_NAME - Add common Docker variables: PUID, PGID, TZ for centralized management - Fix PROJECT_ROOT and SERVICES_BASE_DIR path calculations - Reorganize configuration sections for better clarity - Export common variables for use across services 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f314fd06d3
commit
b0b9712b52
@ -6,9 +6,16 @@
|
|||||||
# Utilisateur système qui exécutera les backups
|
# Utilisateur système qui exécutera les backups
|
||||||
CITADEL_USER="${CITADEL_USER:-citadel}"
|
CITADEL_USER="${CITADEL_USER:-citadel}"
|
||||||
# Racine du projet citadel
|
# Racine du projet citadel
|
||||||
PROJECT_ROOT="${PROJECT_ROOT:-/home/nicolas/dev/citadel}"
|
PROJECT_ROOT="${PROJECT_ROOT:-/home/citadel}"
|
||||||
# Répertoire contenant les services à sauvegarder
|
# Répertoire contenant les services à sauvegarder
|
||||||
SERVICES_BASE_DIR="${SERVICES_BASE_DIR:-/home/$CITADEL_USER/services}"
|
SERVICES_BASE_DIR="${SERVICES_BASE_DIR:-$PROJECT_ROOT/services}"
|
||||||
|
|
||||||
|
# === Variables Communes ===
|
||||||
|
# User/Group IDs pour les containers Docker
|
||||||
|
PUID="${PUID:-1000}"
|
||||||
|
PGID="${PGID:-1000}"
|
||||||
|
# Timezone globale
|
||||||
|
TZ="${TZ:-Europe/Paris}"
|
||||||
|
|
||||||
# === Stockage Restic ===
|
# === Stockage Restic ===
|
||||||
# Chemin de base pour le stockage des backups
|
# Chemin de base pour le stockage des backups
|
||||||
@ -25,7 +32,7 @@ LOG_DIR="${LOG_DIR:-/var/log}"
|
|||||||
# Répertoire temporaire
|
# Répertoire temporaire
|
||||||
TEMP_DIR="${TEMP_DIR:-/tmp}"
|
TEMP_DIR="${TEMP_DIR:-/tmp}"
|
||||||
# Fichier de configuration Restic (généré automatiquement)
|
# Fichier de configuration Restic (généré automatiquement)
|
||||||
RESTIC_CONFIG_FILE="${RESTIC_CONFIG_FILE:-$PROJECT_ROOT/config/restic.conf}"
|
RESTIC_CONFIG_FILE="${RESTIC_CONFIG_FILE:-$HOME/.config/citadel/restic.conf}"
|
||||||
|
|
||||||
# === Politique de Rétention ===
|
# === Politique de Rétention ===
|
||||||
# Nombre de sauvegardes quotidiennes à conserver
|
# Nombre de sauvegardes quotidiennes à conserver
|
||||||
@ -38,18 +45,20 @@ RETENTION_MONTHLY="${RETENTION_MONTHLY:-12}"
|
|||||||
RETENTION_YEARLY="${RETENTION_YEARLY:-3}"
|
RETENTION_YEARLY="${RETENTION_YEARLY:-3}"
|
||||||
|
|
||||||
# === Variables Dérivées (automatiquement calculées) ===
|
# === Variables Dérivées (automatiquement calculées) ===
|
||||||
BACKUP_USER="$CITADEL_USER"
|
|
||||||
BACKUP_HOME="${BACKUP_HOME:-/home/$CITADEL_USER}"
|
BACKUP_HOME="${BACKUP_HOME:-/home/$CITADEL_USER}"
|
||||||
BACKUP_BASE_DIR="${BACKUP_BASE_DIR:-$BACKUP_HOME/backup}"
|
BACKUP_BASE_DIR="${BACKUP_BASE_DIR:-$BACKUP_HOME/backup}"
|
||||||
BACKUP_STORAGE_PATH="$RESTIC_STORAGE"
|
|
||||||
BACKUP_REPO_NAME="$RESTIC_REPO"
|
|
||||||
BACKUP_REPOSITORY="${BACKUP_REPOSITORY:-$RESTIC_STORAGE/$RESTIC_REPO}"
|
BACKUP_REPOSITORY="${BACKUP_REPOSITORY:-$RESTIC_STORAGE/$RESTIC_REPO}"
|
||||||
RESTIC_CACHE_DIR="${RESTIC_CACHE_DIR:-$TEMP_DIR/restic-cache}"
|
RESTIC_CACHE_DIR="${RESTIC_CACHE_DIR:-$TEMP_DIR/restic-cache}"
|
||||||
CONFIG_DIR="${CONFIG_DIR:-$PROJECT_ROOT/config}"
|
CONFIG_DIR="${CONFIG_DIR:-$HOME/.config/citadel}"
|
||||||
SYSTEMD_DIR="${SYSTEMD_DIR:-/etc/systemd/system}"
|
SYSTEMD_DIR="${SYSTEMD_DIR:-/etc/systemd/system}"
|
||||||
SERVICE_TEMPLATE="${SERVICE_TEMPLATE:-service-backup@.service}"
|
SERVICE_TEMPLATE="${SERVICE_TEMPLATE:-service-backup@.service}"
|
||||||
TIMER_TEMPLATE="${TIMER_TEMPLATE:-service-backup@.timer}"
|
TIMER_TEMPLATE="${TIMER_TEMPLATE:-service-backup@.timer}"
|
||||||
|
|
||||||
# === Variables d'export pour Restic ===
|
# === Variables d'export pour Restic ===
|
||||||
export RESTIC_REPOSITORY="$BACKUP_REPOSITORY"
|
export RESTIC_REPOSITORY="$BACKUP_REPOSITORY"
|
||||||
export RESTIC_CACHE_DIR
|
export RESTIC_CACHE_DIR
|
||||||
|
|
||||||
|
# === Variables d'export communes ===
|
||||||
|
export PUID
|
||||||
|
export PGID
|
||||||
|
export TZ
|
||||||
|
Loading…
x
Reference in New Issue
Block a user