fix(server): bind UI to loopback by default and fail loudly on startup errors - #80
Conversation
…p errors - CheckerUiServer takes an explicit bind address; the existing constructor now defaults to loopback, because /api/check is unauthenticated and every accepted request spends the operator's DaData quota. - Main reads CHECKER_BIND_ADDRESS (default loopback) and CHECKER_PORT, prints the address it actually bound, and exits non-zero when the server fails to start instead of returning success. - The container image opts into 0.0.0.0 explicitly (inside a container the boundary is the published port) and docker compose publishes 127.0.0.1:8080. - ContainerHealthCheck derives its default endpoint from CHECKER_PORT instead of a hard-coded 8080, so a container on another port is not marked unhealthy. - README/README.en: prefer DADATA_TOKEN over checker.properties, which Maven packages into the JAR and the image, and document the new variables. Addresses Aardvark findings: unauthenticated DaData proxy binds to all interfaces, compose/Docker expose it, README encourages packaging the token, healthcheck ignores the configured port, startup failures exit with success. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3341a5dbe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } catch (UnknownHostException e) { | ||
| System.out.printf("Cannot resolve %s: %s%n", BIND_ENV, e.getMessage()); | ||
| printHelp(); | ||
| return; |
There was a problem hiding this comment.
Exit nonzero for invalid server environment configuration
When CHECKER_BIND_ADDRESS is unresolvable, this branch prints an error and returns from main, so the JVM exits with status 0 even though the server never started; the newly added invalid and out-of-range CHECKER_PORT branches behave the same way. This defeats failure detection and on-failure restart policies precisely for configuration mistakes, so these startup-validation failures should follow the nonzero exit path used by runServer failures.
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Заменяет отклонённый PR #79 (он был сгенерирован против устаревшей версии файла, откатывал обработку ошибок и виртуальные потоки и ломал Docker жёсткой привязкой к loopback внутри контейнера).
Закрывает пять находок Aardvark по этому репозиторию:
Локально прогнаны MainTest, ContainerHealthCheckTest, CheckerUiServerIntegrationTest — 47 тестов, зелено.
🤖 Generated with Claude Code