diff --git a/scripts/ops/sweep-aws-secrets.sh b/scripts/ops/sweep-aws-secrets.sh index 55db0a11..20450026 100755 --- a/scripts/ops/sweep-aws-secrets.sh +++ b/scripts/ops/sweep-aws-secrets.sh @@ -40,8 +40,8 @@ # # Env vars required: # AWS_REGION — region the secrets live in (default: us-east-1) -# CP_PROD_ADMIN_TOKEN — CP admin bearer for api.moleculesai.app -# CP_STAGING_ADMIN_TOKEN — CP admin bearer for staging-api.moleculesai.app +# CP_ADMIN_API_TOKEN — CP admin bearer for api.moleculesai.app +# CP_STAGING_ADMIN_API_TOKEN — CP admin bearer for staging-api.moleculesai.app # AWS_ACCESS_KEY_ID, — IAM principal with secretsmanager:ListSecrets # AWS_SECRET_ACCESS_KEY and secretsmanager:DeleteSecret. Note: the # prod molecule-cp principal does NOT have @@ -88,8 +88,8 @@ need() { exit 1 fi } -need CP_PROD_ADMIN_TOKEN -need CP_STAGING_ADMIN_TOKEN +need CP_ADMIN_API_TOKEN +need CP_STAGING_ADMIN_API_TOKEN need AWS_ACCESS_KEY_ID need AWS_SECRET_ACCESS_KEY @@ -107,13 +107,13 @@ log() { echo "[$(date -u +%H:%M:%S)] $*"; } # response includes both `id` and `slug`; we extract `id` here. log "Fetching CP prod org ids..." -PROD_IDS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_PROD_ADMIN_TOKEN" \ +PROD_IDS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_ADMIN_API_TOKEN" \ "https://api.moleculesai.app/cp/admin/orgs?limit=500" \ | python3 -c "import json,sys; print(' '.join(o['id'] for o in json.load(sys.stdin).get('orgs',[])))") log " prod orgs: $(echo "$PROD_IDS" | wc -w | tr -d ' ')" log "Fetching CP staging org ids..." -STAGING_IDS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_STAGING_ADMIN_TOKEN" \ +STAGING_IDS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_STAGING_ADMIN_API_TOKEN" \ "https://staging-api.moleculesai.app/cp/admin/orgs?limit=500" \ | python3 -c "import json,sys; print(' '.join(o['id'] for o in json.load(sys.stdin).get('orgs',[])))") log " staging orgs: $(echo "$STAGING_IDS" | wc -w | tr -d ' ')" diff --git a/scripts/ops/sweep-cf-orphans.sh b/scripts/ops/sweep-cf-orphans.sh index 569bcbcf..8a4da90c 100755 --- a/scripts/ops/sweep-cf-orphans.sh +++ b/scripts/ops/sweep-cf-orphans.sh @@ -20,8 +20,8 @@ # Env vars required: # CF_API_TOKEN — Cloudflare token with zone:dns:edit # CF_ZONE_ID — the zone (moleculesai.app) -# CP_PROD_ADMIN_TOKEN — CP admin bearer for api.moleculesai.app -# CP_STAGING_ADMIN_TOKEN — CP admin bearer for staging-api.moleculesai.app +# CP_ADMIN_API_TOKEN — CP admin bearer for api.moleculesai.app +# CP_STAGING_ADMIN_API_TOKEN — CP admin bearer for staging-api.moleculesai.app # AWS_* — standard AWS creds (default region us-east-2) # # Exit codes: @@ -58,21 +58,21 @@ need() { } need CF_API_TOKEN need CF_ZONE_ID -need CP_PROD_ADMIN_TOKEN -need CP_STAGING_ADMIN_TOKEN +need CP_ADMIN_API_TOKEN +need CP_STAGING_ADMIN_API_TOKEN log() { echo "[$(date -u +%H:%M:%S)] $*"; } # --- Gather live sets ------------------------------------------------------ log "Fetching CP prod org slugs..." -PROD_SLUGS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_PROD_ADMIN_TOKEN" \ +PROD_SLUGS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_ADMIN_API_TOKEN" \ "https://api.moleculesai.app/cp/admin/orgs?limit=500" \ | python3 -c "import json,sys; print(' '.join(o['slug'] for o in json.load(sys.stdin).get('orgs',[])))") log " prod orgs: $(echo "$PROD_SLUGS" | wc -w | tr -d ' ')" log "Fetching CP staging org slugs..." -STAGING_SLUGS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_STAGING_ADMIN_TOKEN" \ +STAGING_SLUGS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_STAGING_ADMIN_API_TOKEN" \ "https://staging-api.moleculesai.app/cp/admin/orgs?limit=500" \ | python3 -c "import json,sys; print(' '.join(o['slug'] for o in json.load(sys.stdin).get('orgs',[])))") log " staging orgs: $(echo "$STAGING_SLUGS" | wc -w | tr -d ' ')" diff --git a/scripts/ops/sweep-cf-tunnels.sh b/scripts/ops/sweep-cf-tunnels.sh index bf948940..13734db3 100755 --- a/scripts/ops/sweep-cf-tunnels.sh +++ b/scripts/ops/sweep-cf-tunnels.sh @@ -31,8 +31,8 @@ # token must include the tunnel scope.) # CF_ACCOUNT_ID — the account that owns the tunnels (visible # in dash.cloudflare.com URL path) -# CP_PROD_ADMIN_TOKEN — CP admin bearer for api.moleculesai.app -# CP_STAGING_ADMIN_TOKEN — CP admin bearer for staging-api.moleculesai.app +# CP_ADMIN_API_TOKEN — CP admin bearer for api.moleculesai.app +# CP_STAGING_ADMIN_API_TOKEN — CP admin bearer for staging-api.moleculesai.app # # Exit codes: # 0 — dry-run completed or sweep executed successfully @@ -72,21 +72,21 @@ need() { } need CF_API_TOKEN need CF_ACCOUNT_ID -need CP_PROD_ADMIN_TOKEN -need CP_STAGING_ADMIN_TOKEN +need CP_ADMIN_API_TOKEN +need CP_STAGING_ADMIN_API_TOKEN log() { echo "[$(date -u +%H:%M:%S)] $*"; } # --- Gather live sets ------------------------------------------------------ log "Fetching CP prod org slugs..." -PROD_SLUGS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_PROD_ADMIN_TOKEN" \ +PROD_SLUGS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_ADMIN_API_TOKEN" \ "https://api.moleculesai.app/cp/admin/orgs?limit=500" \ | python3 -c "import json,sys; print(' '.join(o['slug'] for o in json.load(sys.stdin).get('orgs',[])))") log " prod orgs: $(echo "$PROD_SLUGS" | wc -w | tr -d ' ')" log "Fetching CP staging org slugs..." -STAGING_SLUGS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_STAGING_ADMIN_TOKEN" \ +STAGING_SLUGS=$(curl -sS -m 15 -H "Authorization: Bearer $CP_STAGING_ADMIN_API_TOKEN" \ "https://staging-api.moleculesai.app/cp/admin/orgs?limit=500" \ | python3 -c "import json,sys; print(' '.join(o['slug'] for o in json.load(sys.stdin).get('orgs',[])))") log " staging orgs: $(echo "$STAGING_SLUGS" | wc -w | tr -d ' ')"