Skip to content

🔧 fix (compose): KC_HOSTNAME follows KEYCLOAK_PORT override#78

Merged
mrdavidlaing merged 1 commit into
mainfrom
fix/kc-hostname-port-leak
Apr 20, 2026
Merged

🔧 fix (compose): KC_HOSTNAME follows KEYCLOAK_PORT override#78
mrdavidlaing merged 1 commit into
mainfrom
fix/kc-hostname-port-leak

Conversation

@mrdavidlaing

Copy link
Copy Markdown
Contributor

Summary

  • Nest KEYCLOAK_PORT into the KC_HOSTNAME default in apps/sbomify/deployments/compose/docker-compose.yml (line 35) so an operator-supplied KEYCLOAK_PORT flows through to the browser-facing Keycloak URL instead of being stranded at :8180.

Why

Follow-on from #76, which fixed the same shape for APP_BASE_URL/HTTP_PORT. KC_HOSTNAME had the identical pattern bug against KEYCLOAK_PORT: when operators overrode KEYCLOAK_PORT, the Keycloak container bound the new port (line 180) but KC_HOSTNAME still defaulted to http://localhost:8180, so browsers were sent to the wrong port and login flows broke for anyone not on the default port.

Test plan

  • docker compose config with no env → KC_HOSTNAME: http://localhost:8180 (unchanged)
  • KEYCLOAK_PORT=9180 docker compose configKC_HOSTNAME: http://localhost:9180
  • KC_HOSTNAME=http://keycloak.example.com docker compose config → explicit override still wins

Notes

🐃 Shaved by Bob

Same nested-default shape as PR #76 (APP_BASE_URL). When operators
overrode KEYCLOAK_PORT, the container bound the new port but
KC_HOSTNAME still defaulted to :8180, so browsers were sent to the
wrong port. Nest KEYCLOAK_PORT into the default so the two stay
in sync. Verified via `docker compose config`: default resolves to
:8180, KEYCLOAK_PORT=9180 resolves to :9180, explicit KC_HOSTNAME
override still wins.

Co-Authored-By: Bob (Claude) <noreply@anthropic.com>
@mrdavidlaing mrdavidlaing merged commit 97ad845 into main Apr 20, 2026
8 checks passed
@mrdavidlaing mrdavidlaing deleted the fix/kc-hostname-port-leak branch April 20, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant