feat/ft5 3309 s3 toggles source#1
Merged
anydef merged 5 commits intoJul 2, 2026
Merged
Conversation
Contributor
|
@wickner-consid it would be great to have the the integration example inside demo module. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new configuration source that loads feature toggles from S3 object keys (encoding toggle state in the key name), wires it into source discovery, and documents how to configure it.
Changes:
- Introduce
S3TogglesSourceand register it viaCoreSourceFactoryasaws.s3.toggles, with local-profile fallback toproperties.json. - Add unit tests for S3 toggle parsing and S3 listing/pagination merge behavior, plus source discovery tests.
- Document the new source in
README.mdanddocs/AWS_SETUP.md, and add the AWS SDK S3 dependency.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/de/otto/config/source/CoreSourceFactory.java | Registers the new aws.s3.toggles source and local-profile fallback behavior. |
| src/main/java/de/otto/config/source/aws/S3TogglesSource.java | Implements toggle loading from S3 object listings and key-name parsing. |
| src/test/java/de/otto/config/source/CoreSourceFactoryTest.java | Verifies discovery includes S3 toggles source when enabled and uses file source in local profile. |
| src/test/java/de/otto/config/source/aws/S3TogglesSourceTest.java | Verifies merge semantics, pagination handling, and folder-prefix behavior for S3 toggles. |
| src/test/java/de/otto/config/source/aws/ToggleEntryTest.java | Tests parsing rules for on. / off. toggle object key naming. |
| src/test/java/de/otto/config/fixture/MockAwsClients.java | Extends AWS client mocking to include S3Client.builder() for tests. |
| README.md | Lists the new supported source and adds a quick configuration snippet. |
| docs/AWS_SETUP.md | Adds detailed S3 toggles setup, naming conventions, and IAM permissions. |
| build.gradle | Adds software.amazon.awssdk:s3 dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+61
to
+70
| private Stream<String> fetchToggleKeys() { | ||
| return this.s3Client.listObjectsV2Paginator( | ||
| ListObjectsV2Request.builder() | ||
| .bucket(this.bucketName) | ||
| .prefix(this.togglesFolder) | ||
| .build()) | ||
| .stream() | ||
| .flatMap(page -> page.contents().stream()) | ||
| .map(S3Object::key); | ||
| } |
8d25265 to
c6282e3
Compare
3f388b7 to
6fbd3cd
Compare
6fbd3cd to
515a887
Compare
Comment on lines
+43
to
+48
| return S3TogglesSource.builder() | ||
| .s3Client(context.getClientRegistry().registerIfAbsent(S3Client.class, | ||
| () -> S3Client.builder().build())) | ||
| .bucketName(context.getConfiguration().getValue("otto.config.aws.s3.toggles.bucket.name")) | ||
| .togglesFolder(context.getConfiguration().getValue("otto.config.aws.s3.toggles.folder.name")) | ||
| .build(); |
| public void load() { | ||
| boolean value = configurationProvider.getValueAsBoolean("logging_enabled"); | ||
| log.info("Toggle value for logging_enabled: " + value); | ||
| log.info("S3 feature toggle 's3_toggle1' resolved to " + (s3Toggle1.getValue() ? "ENABLED (serving new code path)" : "DISABLED (serving default code path)")); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI
added a commit
that referenced
this pull request
Jul 2, 2026
- CoreSourceFactory: validate bucketName and togglesFolder with IllegalArgumentException when missing from configuration - demo/spring/DemoService: use Boolean.TRUE.equals() for null-safe toggle check to prevent NPE on auto-unboxing - CoreSourceFactoryTest: add tests for missing bucket name and folder name validation
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.
No description provided.