mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-11 03:13:46 +00:00
refactor!: move every config default into compose.yml
compose.yml now holds each default as ${VAR:-default}, and the code keeps
no fallback values. The bot stops at startup on a missing or invalid
PORT or LOG_LEVEL, /addsticker refuses without STICKER_PACK_NAME, and the
renderer refuses to start until every RENDERER_* setting is a valid
value, listing each problem. Settings whose empty value means none or
all (MODULES, OWNER_ID, ADMIN_IDS, the API tokens) use ${VAR:-}.
The renderer's npm start and dev load .env when present, so a local run
works from a copy of .env.example.
BREAKING CHANGE: running outside compose now requires LOG_LEVEL and PORT
for the bot, STICKER_PACK_NAME for /addsticker, and every RENDERER_*
variable for the renderer.
This commit is contained in:
1 parent
4f8c01dae7
commit
153fc211cf
17 files changed
+208
-94
No files matched your search
@@ -34,15 +34,20 @@ Copy [`.env.example`](../.env.example) → `.env` (gitignored) and fill in.
|
||||
| `MODULES` | optional | CSV; empty = all modules, including any added later |
|
||||
| `OWNER_ID` | optional | Telegram user id for owner-only commands, the deploy DM, and the `/addsticker` pack owner. Unset = owner-only commands are denied and `/addsticker` refuses |
|
||||
| `ADMIN_IDS` | optional | CSV of Telegram user ids for admin-only commands |
|
||||
| `STICKER_PACK_NAME` | optional | set `/addsticker` writes to; default `miti99_by_miti99bot`. See [sticker packs](sticker-packs.md) |
|
||||
| `STICKER_PACK_NAME` | optional | set `/addsticker` writes to; `compose.yml` default `miti99_by_miti99bot`. See [sticker packs](sticker-packs.md) |
|
||||
| `LOL_PANDASCORE_TOKEN` | optional | PandaScore API token for the lol module (free tier) — secret, never logged; without it every `/lol*` fetch fails (stale cache may still serve briefly) |
|
||||
| `RENDERER_URL` | leave unset | base URL of the animation renderer; fixed by `compose.yml` to the bundled renderer (`http://renderer:3000`), so a Coolify value is ignored |
|
||||
| `LOG_LEVEL` | optional | `debug`, `info` (default), `warn`, or `error`; logs are JSON on stdout |
|
||||
| `LOG_LEVEL` | optional | `debug`, `info`, `warn`, or `error`; `compose.yml` default `info`; logs are JSON on stdout |
|
||||
| `GOLD_VNAPP_API_KEY` | optional | VNAppMob key — secret; empty = the gold module fetches one and caches it in MongoDB |
|
||||
| `KV_PROVIDER` | leave unset | `memory` or `mongodb`; unset = `mongodb` when `MONGO_URL` is set, otherwise `memory` |
|
||||
| `PORT` | leave unset | health server port; default `8080` |
|
||||
| `PORT` | leave unset | health server port; fixed to `8080` by `compose.yml`, which the health check uses |
|
||||
| `SOURCE_COMMIT` | never set | provided by Coolify at runtime for the deploy DM (see step 5 below) |
|
||||
|
||||
Defaults live in `compose.yml` only (`${VAR:-default}`); the code has no
|
||||
fallback values. `PORT`, `LOG_LEVEL`, and (for `/addsticker`)
|
||||
`STICKER_PACK_NAME` must therefore be set when running outside compose — a
|
||||
missing or invalid `PORT` or `LOG_LEVEL` stops the bot at startup.
|
||||
|
||||
Stock, coin, and gold provider URL overrides are not supported in runtime env;
|
||||
modules use coded defaults. There is no `TELEGRAM_WEBHOOK_SECRET`: long polling
|
||||
has no webhook.
|
||||
|
||||
@@ -22,14 +22,14 @@ Single-shot: one message replying to the media to add. No conversation state.
|
||||
|
||||
## Configuration
|
||||
|
||||
| Env | Default | Meaning |
|
||||
| Env | `compose.yml` default | Meaning |
|
||||
|---|---|---|
|
||||
| `STICKER_PACK_NAME` | `miti99_by_miti99bot` | The Telegram set to write to |
|
||||
| `STICKER_PACK_NAME` | `miti99_by_miti99bot` | The Telegram set to write to; required — unset, `/addsticker` refuses |
|
||||
| `OWNER_ID` | — | Must be the account that **owns** that set |
|
||||
|
||||
`OWNER_ID` is reused rather than given a sticker-specific twin because
|
||||
`addStickerToSet` takes the **set owner's** user ID, not the caller's, and the
|
||||
default pack belongs to the bot owner. Point `OWNER_ID` at the owning account if
|
||||
standard pack belongs to the bot owner. Point `OWNER_ID` at the owning account if
|
||||
the configured pack belongs to someone else.
|
||||
|
||||
The caller's identity is used nowhere. That is what makes the command stateless:
|
||||
|
||||
Reference in new issue
Block a user