Support Git-style searchPaths with wildcards in AWS S3 buckets (#2812) #2958
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
Add full Git-style
searchPaths
support (placeholders + wildcards) to the AWS S3 backend so that users can migrate existing Git-based configurations without renaming toapplication.*
..*
), single (?
) and double (**
) wildcard matching.properties → .json → .yml → .yaml
when expanding literals or.*
patternsThis issue (#2812)
resolves #2812
Changes
Core Logic
Extended
getS3ConfigFileWithSearchPaths(...)
to treat{application}
and{profile}
placeholders identically to the Git backendAdded support for:
.*
): expands against supported extensions in priority order?
)**
)/
Ensured seenKeys set to avoid duplicate property sources
Tests
Added new JUnit 5 tests in
AwsS3EnvironmentRepositoryTests
to cover all scenarios:searchPaths_placeholderOnly_shouldResolveExactFile
searchPaths_wildcardOnly_shouldResolveAllProperties
searchPaths_placeholderAndWildcard_shouldResolveMatchingKeys
searchPaths_orderMatters_forPropertySourceOrder
searchPath_extensionPreserved
(dynamic tests for each extension)searchPaths_applicationAsDirectory_shouldStillHonorSearchPaths
multiDocumentYaml_withSearchPaths_shouldNotSplitDocuments
getLocations_returnsCorrect
searchPaths_deduplication_shouldOnlyAddOnce
searchPaths_singleCharacterWildcard_shouldMatchExactlyOneChar
searchPaths_withEmptyLabel_shouldUseDefaultLabel
searchPaths_multipleLabels_shouldApplyForEachLabelInReverseOrder
searchPaths_literalNotFound_shouldReturnEmpty
…plus the additional edge cases for literal-stop, dot-wildcard priority, and nested directory patterns.
Example Usage
Additional Notes
Backward Compatibility
This update does not break any existing AWS S3 config setups. The default lookup behavior is unchanged if no placeholders or wildcards are used in
searchPaths
.Migration
Existing users migrating from Git-backed config servers can now use their current
searchPaths
(including wildcards and placeholders) on S3 with no renaming or convention change required.Documentation
Documentation and usage examples for the enhanced
searchPaths
will be updated in the relevant documentation files after the merge.If there are specific locations that require documentation updates, please let me know—I will be happy to update them.
Performance and Cost
Using wildcards (such as
*
or**
) in searchPaths may result in additional AWS S3 API calls (e.g., ListObjects), especially for large buckets or deeply nested directory patterns.This could lead to increased latency and higher AWS costs.
Users should consider the structure and size of their buckets when designing searchPaths and monitor AWS S3 usage accordingly.