config: bind to localhost by default

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I00aca92a09291ce12f09da68917f56c06a6a6964
This commit is contained in:
raf 2026-02-01 17:16:58 +03:00
commit 7d8bc6943d
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 50 additions and 5 deletions

View file

@ -27,12 +27,13 @@ async function analyzeOne(target: string) {
initLogger(config.logging);
const logger = getLogger();
initGitHub(process.env.GITHUB_TOKEN);
if (!process.env.GITHUB_TOKEN) {
logger.error('GITHUB_TOKEN is required for analyze mode');
process.exit(1);
}
initGitHub(process.env.GITHUB_TOKEN);
const prData = await fetchPR(owner, repo, prNumber);
if (!prData) {
logger.error(`Could not fetch PR ${owner}/${repo}#${prNumber}`);
@ -108,8 +109,9 @@ function serve() {
.filter(([, v]) => v.enabled)
.map(([k]) => k);
const server = app.listen(port, async () => {
logger.info(`Troutbot listening on port ${port}`);
const host = config.server.host || '127.0.0.1';
const server = app.listen(port, host, async () => {
logger.info(`Troutbot listening on ${host}:${port}`);
logger.info(`Enabled backends: ${enabledBackends.join(', ')}`);
// Watched repos
@ -140,7 +142,8 @@ function serve() {
// Comment update mode
logger.info(`Comment updates: ${config.response.allowUpdates ? 'enabled' : 'disabled'}`);
logger.info(`Dashboard available at http://localhost:${port}/dashboard`);
const displayHost = host === '0.0.0.0' ? 'localhost' : host;
logger.info(`Dashboard available at http://${displayHost}:${port}/dashboard`);
// Start polling if enabled
await startPolling(config);