From 0b9933c4859452360e0aab0abed044e3ba60b70e Mon Sep 17 00:00:00 2001 From: louispaulb Date: Mon, 6 Jul 2026 21:55:35 -0400 Subject: [PATCH] targo-sync: retirer le mdp F du repo + cron quotidien tickets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ⚠️ SÉCURITÉ : le défaut en dur du mdp F ("facturation") avait fuité dans sync_services / sync_invoices (commit 004c3f8). Défaut passé à "" (secret via env uniquement). Le mdp est DÉSORMAIS chargé depuis /opt/targo-sync/secrets.env (hôte, chmod 600, gitignored). NB : le mdp reste dans l'HISTORIQUE git (004c3f8) → rotation recommandée (décision Louis). Cron quotidien tickets (récurrence #26) : - tickets-daily.sh (30 4 * * *) → migrate_tickets.py (idempotent), n'importe que les nouveaux. - Séparé de run.sh (horaire) : scan 252k trop lourd pour l'horaire. - .gitignore : secrets.env / *.env / *.log / .lock jamais versionnés. Co-Authored-By: Claude Opus 4.8 --- scripts/targo-sync/.gitignore | 7 +++++++ scripts/targo-sync/README.md | 22 ++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 scripts/targo-sync/.gitignore diff --git a/scripts/targo-sync/.gitignore b/scripts/targo-sync/.gitignore new file mode 100644 index 0000000..2ce3fc6 --- /dev/null +++ b/scripts/targo-sync/.gitignore @@ -0,0 +1,7 @@ +# Secrets hôte — JAMAIS versionnés +secrets.env +*.env +# Logs + locks runtime +*.log +.lock +.*.lock diff --git a/scripts/targo-sync/README.md b/scripts/targo-sync/README.md index 77d8b15..3514012 100644 --- a/scripts/targo-sync/README.md +++ b/scripts/targo-sync/README.md @@ -52,8 +52,26 @@ Réconciliation visible dans OPS : page **/sync-legacy** → carte « Réconcili ## Fichiers +## Tickets → Issue (cron QUOTIDIEN séparé) + +`tickets-daily.sh` (cron `30 4 * * *`) lance `migrate_tickets.py` (idempotent, skip par +`legacy_ticket_id`) pour n'importer que les nouveaux tickets. Séparé de `run.sh` (horaire) car +le scan de 252k tickets est trop lourd pour l'horaire. Le canonique de `migrate_tickets.py` est +`scripts/migration/` ; en déployer une copie dans `/opt/targo-sync/`. Messages des tickets *closed* +non importés (deferred ; `import_ticket_msgs.py` au besoin). + +## 🔐 Secrets — JAMAIS dans le repo + +Le mot de passe F (`LEGACY_PW`) se charge depuis `/opt/targo-sync/secrets.env` (hôte, `chmod 600`, +**non versionné** — voir `.gitignore`). Les `.py` du repo ont un défaut VIDE (`os.environ.get("LEGACY_PW","")`). +Ne **jamais** committer une copie prod d'un script qui aurait le mot de passe en dur. + +## Fichiers + | Fichier | Rôle | |---|---| -| `run.sh` | Orchestrateur cron (4 étapes DAG) | -| `sync_services_incremental.py` | Service Location (delivery) + Service Subscription (service) : création + prix + **statut (fix fantômes)** | +| `run.sh` | Orchestrateur cron horaire (4 étapes DAG) | +| `sync_services_incremental.py` | Service Location (delivery) + Service Subscription (service) : création + prix + **statut (fix fantômes raffiné)** | | `sync_invoices_incremental.py` | Sales Invoice (miroir des factures F ; statut reflétant F) | +| `tickets-daily.sh` | Wrapper cron quotidien → `migrate_tickets.py` (secret via `secrets.env`) | +| `secrets.env` | **Hôte seulement, non versionné** : `LEGACY_PW=…` |