fix(config): warn when a public address is announced but only loopback is bound

`WEB_HOST=127.0.0.1` is the right default behind a reverse proxy on the same
machine, and the wrong one inside a container or on a hosting panel, where
the process has to bind the allocation. The guidance only mentioned the
first case, so a `.env` written from the wizard could leave the dashboard
listening where nothing could reach it — every request timing out with
nothing saying why.

The wizard now flags the contradiction between a loopback bind and a public
URL, and both the help text and `.env.example` name the container case.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
nocodeandClaude Opus 5 committed 2026-09-23 23:20:07 +02:00
1 parent 5660235f3d
commit 40032ec091
3 files changed
+44 -4

No files matched your search

+24
View File
@@ -88,6 +88,30 @@ describe('env schema', () => {
assert.ok(warnings.some((warning) => warning.includes('rejetés')));
});
it('warns when a public address is announced but only loopback is bound', () => {
// The failure it prevents: the site answers on the loopback while a domain
// points at it, so every request times out and nothing says why.
const warnings = crossCheck({
WEB_ENABLED: 'true',
WEB_HOST: '127.0.0.1',
WEB_PUBLIC_URL: 'https://bot.example.org',
DISCORD_CLIENT_SECRET: 'x',
WEB_SESSION_SECRET: 'y',
});
assert.ok(warnings.some((warning) => warning.includes('boucle locale')));
});
it('stays quiet when the loopback matches the announced address', () => {
const warnings = crossCheck({
WEB_ENABLED: 'true',
WEB_HOST: '127.0.0.1',
WEB_PUBLIC_URL: 'http://localhost:3080',
DISCORD_CLIENT_SECRET: 'x',
WEB_SESSION_SECRET: 'y',
});
assert.ok(!warnings.some((warning) => warning.includes('boucle locale')));
});
it('warns when the dashboard is exposed without HTTPS', () => {
const warnings = crossCheck({
WEB_ENABLED: 'true',