mirror of
https://github.com/tiennm99/miti99bot-js.git
synced 2026-05-21 02:24:41 +00:00
6f0b5ff0a8
Code/config slice of plan phase 01 (operator-only steps for cluster
provisioning, secrets, and runtime smoke tests deferred to user).
- wrangler.toml: add `compatibility_flags = ["nodejs_compat_v2"]`
(compatibility_date `2025-10-01` already satisfies ≥ 2025-03-20)
- .env.deploy.example: add `MONGODB_URI` placeholder with mirror-protocol note
- scripts/check-secret-leaks.js: lint that fails build on `console.log(env.<SECRET>)`
for MONGODB_URI / TELEGRAM_BOT_TOKEN / TELEGRAM_WEBHOOK_SECRET / ADMIN_TOKEN
- package.json: install mongodb@^6.7.0 (resolved 6.21.0); wire secret-leak
check into `npm run lint`
- docs/using-mongodb.md: operational runbook (cluster spec, free-tier ceiling,
auto-pause behavior, network access permanence, rollback, rotation)
Bundle-size HARD GATE: PASS. Probe with `import { MongoClient }` measures
226 KiB gzipped (3 MiB Free cap, 92% headroom) — nodejs_compat_v2 provides
node:net/tls/crypto from runtime so transitive deps stay unbundled.
CPU-time gate and auto-pause behavior gate require real Atlas access;
deferred to operator (see docs/using-mongodb.md for procedure).
503/503 vitest tests still pass.
23 lines
1.1 KiB
Bash
23 lines
1.1 KiB
Bash
# Post-deploy registration env, consumed by `scripts/register.js` via
|
|
# `node --env-file=.env.deploy`. Copy to .env.deploy (gitignored) and fill in.
|
|
#
|
|
# TELEGRAM_BOT_TOKEN + TELEGRAM_WEBHOOK_SECRET must match the values set via
|
|
# `wrangler secret put` so the Worker and Telegram agree on the same secret.
|
|
TELEGRAM_BOT_TOKEN=
|
|
TELEGRAM_WEBHOOK_SECRET=
|
|
|
|
# Public URL of the deployed Worker (no trailing slash). Known after the first
|
|
# `wrangler deploy`. Example: https://miti99bot.your-subdomain.workers.dev
|
|
WORKER_URL=
|
|
|
|
# Same MODULES value as wrangler.toml [vars]. Duplicated here so the register
|
|
# script can derive the public command list without parsing wrangler.toml.
|
|
MODULES=util,wordle,loldle,misc,trading,lolschedule,semantle,doantu,twentyq
|
|
|
|
# MongoDB Atlas connection string. Used by the `mongodb` driver inside the Worker
|
|
# AND by local backfill / verify scripts. MUST match the value set via
|
|
# `wrangler secret put MONGODB_URI` for the Worker. Same secret-mirror protocol
|
|
# as TELEGRAM_BOT_TOKEN / TELEGRAM_WEBHOOK_SECRET.
|
|
# Format: mongodb+srv://miti99bot-worker:<pass>@<host>/miti99bot?retryWrites=true&w=majority
|
|
MONGODB_URI=
|