Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores POSTGRES_JNDI_ENABLED as an effective toggle by ensuring the PostgreSQL JNDI <Resource> is only present in the generated Tomcat server.xml when explicitly enabled, aligning runtime behavior with the documented environment variable contract.
Changes:
- Wraps the PostgreSQL JNDI
<Resource>blocks inconfig/server.xmlandconfig/server-https.xmlwith begin/end marker comments. - Removes the dead
context.xmloverride path and strips the marked JNDI block from the renderedserver.xmlwhenPOSTGRES_JNDI_ENABLED != true. - Updates README documentation to remove references to the (now non-existent)
context.xml.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| startup.sh | Removes legacy context.xml handling and strips the marked JNDI block from the rendered server.xml when not enabled. |
| README.md | Updates documentation to reflect that JNDI settings now live in server.xml rather than context.xml. |
| config/server.xml | Adds marker comments around the PostgreSQL JNDI <Resource> so it can be conditionally removed at startup. |
| config/server-https.xml | Adds the same marker comments for the HTTPS server template. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
startup.sh:9
- The comment refers to
POSTGRES_JNDI_PASSWORD, but that variable doesn't exist in the repo (the documented env var isPOSTGRES_PASSWORD). This can mislead users/maintainers reading the script.
# <!-- POSTGRES_JNDI_RESOURCE_BEGIN --> ... <!-- POSTGRES_JNDI_RESOURCE_END -->
# markers in the default server.xml / server-https.xml templates. Applying the
# filter before envsubst ensures that credentials (e.g. POSTGRES_JNDI_PASSWORD)
# are never substituted into the rendered file when JNDI is disabled.
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.
fix: correct usage of
POSTGRES_JNDI_ENABLEDBackground
The PostgreSQL JNDI configuration was moved some time ago from a separate
context.xmlintoserver.xml(andserver-https.xml). As a side effect,POSTGRES_JNDI_ENABLEDbecame effectively a no-op: the<Resource>definition was hard-coded inserver.xml, and the only remaining code path that still evaluated the variable merely tried to copy a (no longer existing)context.xml.As a result, the JNDI resource was always created — even when
POSTGRES_JNDI_ENABLEDwas unset orfalse.Changes
config/server.xmlandconfig/server-https.xml: The<Resource>block for the PostgreSQL JNDI DataSource is now wrapped with marker comments:startup.sh:context.xml.server.xml, the marked JNDI block is stripped viasedunlessPOSTGRES_JNDI_ENABLEDis set totrue.README.md: Cleaned up the note referring to the (no longer existing)context.xml.Behavior after the fix
POSTGRES_JNDI_ENABLEDserver.xmltrue<Resource>is keptfalse/ anything else<Resource>is removedHow to test
POSTGRES_JNDI_ENABLED→$CATALINA_HOME/conf/server.xmlmust not contain any<Resource name="jdbc/postgres" .../>entry.POSTGRES_JNDI_ENABLED=trueand the otherPOSTGRES_JNDI_*variables set → the<Resource>block must be present and populated with the provided values; GeoServer can reference the DataSource viajava:comp/env/jdbc/postgres.HTTPS_ENABLED=true(which usesserver-https.xmlas the template).Breaking changes
None. Users who previously set
POSTGRES_JNDI_ENABLED=truewill get the exact same resource as before. Users who did not set the variable were unintentionally getting a JNDI resource anyway; this PR fixes that.