fix(config): honor $PORT directly (PR #2 follow-up)#3
Conversation
…:10000 Resolves the PR #2 follow-up: render.yaml no longer needs to hardcode HOOKS_LISTEN_ADDR=:10000 to match Render's $PORT default. Listen-address precedence: HOOKS_LISTEN_ADDR > yaml listen_addr > $PORT > :8080. A set-but-unparseable PORT errors at Parse time rather than silently demoting to :8080 — silent demotion would mask "service unreachable" failures behind a default that PaaS load balancers can't reach.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Summary
internal/configto honor$PORTso deployments on Render/Heroku/Fly/Cloud Run don't need a hardcodedHOOKS_LISTEN_ADDR=:10000envVar. New precedence:HOOKS_LISTEN_ADDR> yamllisten_addr>:$PORT>:8080.HOOKS_LISTEN_ADDR=:10000fromrender.yaml; the platform-injected$PORTnow drives the bind address automatically.PORT(typo, out-of-range,0) errors atParsetime rather than silently falling back to:8080— silent demotion would mask "service unreachable" failures behind a default the PaaS load balancer can't reach.Resolves the follow-up flagged in PR #2: "Render PORT contract... The cleaner fix is to teach internal/config to honor $PORT directly."
Test plan
go test -race ./...— all packages passmake lint— 0 issuesTestListenAddrPrecedencecovers 8 cases: PORT honored, yaml beats PORT,HOOKS_LISTEN_ADDRbeats both, unset → default, and three error paths (non-numeric, out-of-range 70000, port 0)PORT=12345→ server logsaddr=:12345and/readyzreturns 200PORT=garbage→ refuses to start withconfig: PORT="garbage" is not a valid TCP port (1-65535)PORT=70000→ same error pathHOOKS_LISTEN_ADDR=:23456 PORT=12345→ binds:23456(override wins)Review notes
PORTerrors regardless of whetherHOOKS_LISTEN_ADDRis also set — i.e. the env override does not "rescue" a typo'dPORT. This is intentional (loud-fail principle) and the operator can fix or unsetPORTif they hit it. Happy to makeHOOKS_LISTEN_ADDRshort-circuit the validation if reviewers prefer that contract.PORT=0is rejected by the1 <= n <= 65535guard. Some Go programs use:0to mean "OS picks an ephemeral port" vianet.Listen; PaaS providers never inject0, so locking it out is fine for this server but worth flagging.