feat(config): declare the web dashboard environment variables

The dashboard is off by default and listens on the loopback interface: it
must be an explicit decision to expose it, not a side effect of upgrading.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
nocodeandClaude Opus 5 committed 2026-09-23 20:09:12 +02:00
1 parent 92405ac618
commit e4534d4d50
2 files changed
+52 -1

No files matched your search

+25 -1
View File
@@ -79,6 +79,23 @@ export const env = Object.freeze({
secret: read('GITEA_WEBHOOK_SECRET'),
},
web: {
enabled: readBool('WEB_ENABLED'),
host: read('WEB_HOST', '127.0.0.1'),
port: readInt('WEB_PORT', 3080),
publicUrl: read('WEB_PUBLIC_URL', '').replace(/\/+$/, ''),
sessionSecret: read('WEB_SESSION_SECRET'),
sessionTtlHours: readInt('WEB_SESSION_TTL_HOURS', 12),
oauthClientSecret: read('DISCORD_CLIENT_SECRET'),
setupToken: read('WEB_SETUP_TOKEN'),
// Running shell commands from a browser is the most dangerous capability of the
// dashboard, so it stays off until it is explicitly enabled (M16-T06).
allowCommandDeploys: readBool('WEB_ALLOW_COMMAND_DEPLOYS'),
allowRestart: readBool('WEB_ALLOW_RESTART'),
deployTimeoutMs: readInt('WEB_DEPLOY_TIMEOUT_MS', 900_000),
rateLimitPerMinute: readInt('WEB_RATE_LIMIT_PER_MINUTE', 240),
},
database: {
path: read('DATABASE_PATH', './data/fws-bot.sqlite'),
backupDir: read('BACKUP_DIR', './data/backups'),
@@ -93,7 +110,14 @@ export const env = Object.freeze({
});
/** Values that must never appear in Discord messages or logs. */
export const secrets = [env.discord.token, env.gitea.token, env.webhook.secret].filter(Boolean);
export const secrets = [
env.discord.token,
env.gitea.token,
env.webhook.secret,
env.web.sessionSecret,
env.web.oauthClientSecret,
env.web.setupToken,
].filter(Boolean);
export function assertRequiredEnv(keys) {
const missing = keys.filter((key) => !read(key));