From 039a2a606b72961217701e9c53026a5de3162af6 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Sat, 8 Aug 2026 15:34:45 +0330 Subject: [PATCH] Fix SMS batch apply dry-run env and add rollout tracker. Co-authored-by: Cursor --- deploy/khanegi-sms-rollout-tracker.md | 34 +++++++++++++++++++++++++++ prisma/import-sms-batch.ts | 8 +++++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 deploy/khanegi-sms-rollout-tracker.md diff --git a/deploy/khanegi-sms-rollout-tracker.md b/deploy/khanegi-sms-rollout-tracker.md new file mode 100644 index 0000000..0a5f7bf --- /dev/null +++ b/deploy/khanegi-sms-rollout-tracker.md @@ -0,0 +1,34 @@ +# Khanegi SMS sync — rollout tracker + +Fill this after running inventory on SuperAdmin: + +```bash +cd /var/www/superadmin/api +git pull +bash deploy/run-khanegi-sms-inventory.sh +# or: npm run prisma:inventory-khanegi-sms +``` + +Rule: one row = one sold version = one MySQL = one `.env` = one `SUPERADMIN_SMS_DOMAIN`. + +| domain | serverHost | syncStatus | imported | remote_enabled | probe_ok | notes | +|--------|------------|------------|----------|----------------|----------|-------| +| | | | | | | | + +## Pilot + +- [ ] Choose low-risk domain (`pilot: true` in `prisma/khanegi-sms-targets.json`) +- [ ] Note local balance / price / block from Khanegi panel +- [ ] Dry-run import +- [ ] Apply import +- [ ] Match numbers in SuperAdmin UI +- [ ] Enable `SUPERADMIN_SMS_*` only on that version `.env` +- [ ] `php artisan sms:superadmin-probe` +- [ ] Parallel smoke (charge / price / send) + +## Rollout + +- [ ] Remaining targets dry-run +- [ ] Remaining targets apply +- [ ] Enable remote per install +- [ ] Skip `sms_panel=me` / missing wallet diff --git a/prisma/import-sms-batch.ts b/prisma/import-sms-batch.ts index dcf0ee4..a7cd62f 100644 --- a/prisma/import-sms-batch.ts +++ b/prisma/import-sms-batch.ts @@ -101,17 +101,21 @@ function main() { continue; } - const childEnv = { + const childEnv: NodeJS.ProcessEnv = { ...process.env, SMS_IMPORT_DOMAIN: target.domain, SMS_IMPORT_PRODUCT: product, - SMS_IMPORT_DRY_RUN: dryRun ? '1' : env('SMS_IMPORT_DRY_RUN'), SMS_IMPORT_DB_HOST: String(db.host || '127.0.0.1'), SMS_IMPORT_DB_PORT: String(db.port || 3306), SMS_IMPORT_DB_USER: String(db.user || 'root'), SMS_IMPORT_DB_PASSWORD: String(db.password ?? ''), SMS_IMPORT_DB_DATABASE: String(db.database), }; + if (dryRun) { + childEnv.SMS_IMPORT_DRY_RUN = '1'; + } else { + delete childEnv.SMS_IMPORT_DRY_RUN; + } console.log(`\n=== ${dryRun ? 'DRY ' : ''}IMPORT ${target.domain} (${product}) ===`); const result = spawnSync(