fix wsl default listen host (#542)

This commit is contained in:
ekko
2026-05-08 15:47:03 +08:00
committed by GitHub
parent d54f9479b9
commit 39acd3574a
6 changed files with 14 additions and 67 deletions
+3 -3
View File
@@ -1,14 +1,14 @@
import { resolve } from 'path'
import { homedir } from 'os'
export function getListenHost(env: Record<string, string | undefined> = process.env): string | undefined {
export function getListenHost(env: Record<string, string | undefined> = process.env): string {
const host = env.BIND_HOST?.trim()
return host || undefined
return host || '0.0.0.0'
}
export const config = {
port: parseInt(process.env.PORT || '8648', 10),
// Default undefined: listenWithFallback tries :: first, falls back to 0.0.0.0
// Default to IPv4 for stable WSL/Windows browser access. Use BIND_HOST=:: explicitly for IPv6.
host: getListenHost(),
upstream: process.env.UPSTREAM || 'http://127.0.0.1:8642',
uploadDir: process.env.UPLOAD_DIR || resolve(homedir(), '.hermes-web-ui', 'upload'),