Files
iishko-public/.env.example
T
Vlad Gothbreach af292ff15d
checks / pytest (push) Has been cancelled
checks / moderation (push) Has been cancelled
checks / node (push) Has been cancelled
Harden entry safety, unify runtime config, bound document unpacking
Shared-IP safety: entry autoban and entry notifications default off, and a
shared IP is treated as review evidence only. ban_user/ban_cluster refuse
reason=entry_ip_collision (also with the legacy flag set to 1), so token status
and quota are never touched; explicit admin moderation still works.

Reproducible startup: new bot/runtime_config.py and scripts/run.py load the
repository .env (or --env-file) without shell interpolation, normalize
config/DB/upstream aliases, and make the bot, Mini App, gateway, econ cap,
account admin, mk_daemon, entry admin and key notifications resolve the same
paths. "run.py <target> --check" is an offline preflight that starts nothing
and reports placeholders, missing upstream DB and invalid data directories.

Resource limits: aggregate Office decompression, a 400 read-entry cap and a
per-row XLSX cell budget stop early; truncated or corrupt archives are
reported instead of raising.

Deploy and docs: only source-backed systemd units remain, and
deploy/runtime.env.example documents the environment contract including the
0600 session-secret file rules. Removed the destructive
"cp bot/iishko_bot.py bot/grok_bot.py" instruction, the unused generated site/
snapshot and the unsupported iishko-ts staging unit; corrected .env.example,
README, ARCHITECTURE, SECURITY, docs/native-gateway.md and iishko-ts/README.md.

Tests: entry safety, runtime bootstrap, economy paths, file intake, deploy
contract, abilities_guard CLI, and a startup smoke that launches all three
components through scripts/run.py with non-loopback network blocked. Every
config reader, selfcheck included, accepts a UTF-8 BOM.

Verified on this tree: pytest 716 passed + 322 subtests, node --test 73/73,
go test and go vet clean, selfcheck --source-only ok, gitleaks worktree and
history 0 findings. No production or live-split changes are included.
2026-10-31 00:39:35 +03:00

85 lines
4.2 KiB
Bash

# iishko — environment template. Copy to .env (never committed) or export in the
# service environment. Everything below is a placeholder; no real secret is here.
# cp .env.example .env
# === Layout ===
# Bot module directory; scripts/run.py resolves relative paths from the repo root.
IISHKO_APP_ROOT=./bot
# Optional override of the bot source file. Default: $IISHKO_APP_ROOT/grok_bot.py
IISHKO_BOT_SOURCE=
# scripts/run.py sets the cross-platform module path; no manual PYTHONPATH needed.
# Direct starts from the repo root: POSIX PYTHONPATH="$PWD/bot:$PWD/gateway:$PWD/bot/webapp"
# PowerShell: $env:PYTHONPATH="$PWD/bot;$PWD/gateway;$PWD/bot/webapp"
# === Bot identity ===
GROK_BOT_TOKEN=REPLACE_ME_TELEGRAM_BOT_TOKEN
GROK_BOT_CFG=./bot/config.json
GROK_BOT_ALLOW_LOCAL=1 # 1 only for a local single-instance run
# === Databases (canonical names first, legacy aliases kept for older units) ===
IISHKO_BOT_DB=./bot.db # bot SQLite: users, keys, economy
GROK_BOT_DB=./bot.db # legacy alias of IISHKO_BOT_DB
GATE_BOT_DB=./bot.db # gateway-side alias of the same file
IISHKO_GW_DB=./one-api.db # external New API SQLite; economy/key operations WRITE here
IISHKO_SKIN_DB=./skin.db # skin/site accounts
# GATE_TG_DB is the legacy alias; IISHKO_SKIN_DB takes precedence.
TG_SID_SECRET_FILE=./.local/tg-sid-secret # private login/session secret, never commit
GATE_NEWAPI_DB=./one-api.db # legacy alias of IISHKO_GW_DB
IISHKO_ECON_STATE=./econ_cap_state.json # shared economy pause/cap state
# === Upstream (external New API / one-api, AGPL-3.0, not bundled) ===
IISHKO_UPSTREAM=http://127.0.0.1:48000 # canonical upstream base URL
NEWAPI_URL=http://127.0.0.1:48000 # legacy alias read by bot config code
NEWAPI_PASS=REPLACE_ME_NEWAPI_ADMIN_PASSWORD
# === Gateway / skin (loopback only) ===
IISHKO_GATEWAY_HOST=127.0.0.1
IISHKO_GATEWAY_PORT=48001
# Provider pinning registry (opt-in). Requires a New API admin/owner credential.
# Example shape only: gateway/providers.example.json
IISHKO_PROVIDERS_FILE=
# === Mini App backend (loopback only) ===
IISHKO_WEBAPP_HOST=127.0.0.1
IISHKO_WEBAPP_PORT=8850
IISHKO_WEBAPP_PUBLIC_BASE=http://127.0.0.1:8850
# === Operators (comma separated; source contains no ids) ===
IISHKO_ADMIN_IDS=
IISHKO_ADMIN_USERNAMES=
IISHKO_PROTECTED_UIDS=
# Owner identity: 0 (default) = nobody holds owner privileges.
IISHKO_OWNER_UID=0
# Broadcast test targets ([BC-PREM]); empty = the admin set above.
IISHKO_BC_TEST_UIDS=
# Server/egress IPs excluded from the Mini App IP-lock collision scan.
# Loopback (127.0.0.1, ::1) is always excluded; put no production IP in source.
IISHKO_SRV_EXCLUDED_IPS=
# === Commerce: purchases are config-gated, there are NO enable flags ===
# The code does not read IISHKO_WALLET_ENABLED / IISHKO_PAID_OFFERS_ENABLED /
# IISHKO_COMMUNITY_BOARD_ENABLED — they are not defined here on purpose.
#
# bot/config.json "commerce_offers": [] -> purchases disabled; no default prices exist
# bot/config.json "cryptopay_token": "" -> payment create/verify unavailable
# env CRYPTOPAY_TOKEN (below) -> takes priority over the config value
#
# community_board and account_balances have no disable switch: board routes are served
# and access is limited by auth/ban/admin gates. Empty offers disable purchases only —
# reading an existing wallet and grants keeps working.
# === Other optional features, off by default ===
IISHKO_ENTRY_AUTOBAN=0 # legacy API compatibility; no automatic IP enforcement
IISHKO_BC_PREMIUM_AUTOFILL=0 # cosmetic broadcast emoji autofill
IISHKO_SANDBOX_ENABLED=0 # external command/file execution surface
IISHKO_NOTIFICATIONS_ENABLED=0 # outbound Telegram notifications
# Optional delivery kill switches; only meaningful after NOTIFICATIONS_ENABLED=1:
# IISHKO_SUPPORT_DELIVERY_ENABLED=0 # suppress support and entry alerts
# IISHKO_ENTRY_DELIVERY_ENABLED=0 # suppress entry alerts only
IISHKO_MEMORY_OFF=1 # 1 = no persistent chat context in RAM
# === Media / payments providers (disabled while empty) ===
CRYPTOPAY_TOKEN=
XROCKET_TOKEN=
G2A_API_KEY=