Export environment variables in scripts to fix passphrase prompts

- Add 'set -a' and 'set +a' around 'source .env' in healthcheck.sh and restore.sh
- Ensures environment variables are exported to child processes (borg, borgmatic)
- Fixes issue where scripts would prompt for BORG_PASSPHRASE despite .env being loaded
- Update TODO.md: mark completed items, improve formatting

Scripts updated:
- scripts/healthcheck.sh: Export vars before calling borgmatic commands
- scripts/restore.sh: Export vars before calling borg commands

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
BeauTroll
2025-12-16 08:15:17 +01:00
parent 24d3e7d914
commit fa78f80d73
3 changed files with 20 additions and 11 deletions

View File

@@ -13,11 +13,15 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Charger les variables d'environnement
# Charger et exporter les variables d'environnement
if [ -f /etc/borgmatic/.env ]; then
set -a
source /etc/borgmatic/.env
set +a
elif [ -f .env ]; then
set -a
source .env
set +a
fi
ERRORS=0

View File

@@ -13,11 +13,15 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Charger les variables d'environnement
# Charger et exporter les variables d'environnement
if [ -f /etc/borgmatic/.env ]; then
set -a
source /etc/borgmatic/.env
set +a
elif [ -f .env ]; then
set -a
source .env
set +a
else
echo -e "${RED}❌ Fichier .env non trouvé${NC}"
exit 1