feat(server): make server host and port configurable (#127)

* feat(server): make server host and port configurable

Support configuring server binding address via environment variables
and config files. Priority: ENV > local_config.yml > config.yml > default.

- Add host and port options to system section in config.yml
- Read SERVER_HOST and SERVER_PORT from environment variables
- Default to 127.0.0.1:8002 for security

Set host to "0.0.0.0" to allow LAN access.

* test(server): add comprehensive tests for server binding config

Add 28 test cases covering:
- Environment variable priority (SERVER_HOST, SERVER_PORT)
- Config file reading (system.host, system.port)
- Default value fallback
- OmegaConf integration
- Edge cases (IPv6, empty values, invalid ports)

* docs: add mobile/LAN access instructions

- Add mobile access section to README and EN_README
- Configure Vite to listen on 0.0.0.0 for LAN access in dev mode
- Link to Issue #130 for mobile UI compatibility tracking
This commit is contained in:
Zihao Xu
2026-02-04 05:47:17 -08:00
committed by GitHub
parent f15ee94559
commit bd6f7e67d5
6 changed files with 543 additions and 5 deletions

View File

@@ -26,6 +26,7 @@ export default defineConfig(({ mode }) => {
assetsDir: 'web_static', // 避免与游戏原本的 /assets 目录冲突
},
server: {
host: '0.0.0.0', // 允许局域网访问
proxy: {
'/api': {
target: API_TARGET,