🔧 fix (compose): KC_HOSTNAME follows KEYCLOAK_PORT override#78
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
KEYCLOAK_PORTinto theKC_HOSTNAMEdefault inapps/sbomify/deployments/compose/docker-compose.yml(line 35) so an operator-suppliedKEYCLOAK_PORTflows 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_HOSTNAMEhad the identical pattern bug againstKEYCLOAK_PORT: when operators overrodeKEYCLOAK_PORT, the Keycloak container bound the new port (line 180) butKC_HOSTNAMEstill defaulted tohttp://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 configwith no env →KC_HOSTNAME: http://localhost:8180(unchanged)KEYCLOAK_PORT=9180 docker compose config→KC_HOSTNAME: http://localhost:9180KC_HOSTNAME=http://keycloak.example.com docker compose config→ explicit override still winsNotes
KC_HOSTNAMEin the compose file (unlikeAPP_BASE_URL, which had two).docker compose configcovers substitution behaviour.🐃 Shaved by Bob