SystemConfigReader for Apple platforms using NSUserDefaults#1231
Merged
SystemConfigReader for Apple platforms using NSUserDefaults#1231
Conversation
Introduce `SystemConfigReader` and `SystemSecretsReader` interfaces to standardize access to configuration values and secrets across different platforms. This change utilizes the `expect`/`actual` mechanism to define common contracts with specific platform implementations. * Implement fully functional readers for the JVM target: the configuration reader resolves values from environment variables and system properties (supports name normalization), while the secrets reader strictly uses environment variables for security. * Add stub implementations for Android, Apple, JS, and WasmJS platforms that currently throw a `NotImplementedError` when accessed. * Define the common interfaces and factory functions to allow retrieval of configuration strings and secrets.
Add `UserDefaultsSystemConfigReader` backed by Apple's NSUserDefaults for retrieving configuration properties. Update `systemConfigReader` to use this implementation and introduce comprehensive unit tests to ensure correctness.
15 tasks
Qodana for JVM1180 new problems were found
@@ Code coverage @@
+ 72% total lines covered
16830 lines analyzed, 12203 lines covered
# Calculated according to the filters of your coverage tool☁️ View the detailed Qodana report Contact Qodana teamContact us at qodana-support@jetbrains.com
|
EugeneTheDev
approved these changes
Dec 5, 2025
Collaborator
EugeneTheDev
left a comment
There was a problem hiding this comment.
Thank you for a speedy implementation, let's merge it
| override fun getConfigVariable(name: String): String? { | ||
| return System.getenv(name) | ||
| ?: System.getProperty(name) | ||
| ?: System.getProperty(normalizePropertyName(name)) |
Collaborator
There was a problem hiding this comment.
I'm not really sure about this part, but now it looks better, since at least it won't miss variables unexpectedly. We can discuss this part separately later
vova-jb
pushed a commit
that referenced
this pull request
Jan 27, 2026
# Add multiplatform system configuration and secrets readers with JVM-specific implementation Introduce `SystemConfigReader` and `SystemSecretsReader` interfaces to standardize access to configuration values and secrets across different platforms. This change utilizes the `expect`/`actual` mechanism to define common contracts with specific platform implementations. * Implement fully functional readers for the JVM target: the configuration reader resolves values from environment variables and system properties (supports name normalization), while the secrets reader strictly uses environment variables for security. * Add stub implementations for Android, Apple, JS, and WasmJS platforms that currently throw a `NotImplementedError` when accessed. * Define the common interfaces and factory functions to allow retrieval of configuration strings and secrets. * Add `UserDefaultsSystemConfigReader` backed by Apple's NSUserDefaults for retrieving configuration properties. Update `systemConfigReader` to use this implementation and introduce comprehensive unit tests to ensure correctness. ## Motivation and Context Should be used in Debugger Config and LLM Clients See also #1228 ## Breaking Changes No --- #### Type of the changes - [x] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Tests improvement - [ ] Refactoring #### Checklist - [x] The pull request has a description of the proposed change - [x] I read the [Contributing Guidelines](https://github.com/JetBrains/koog/blob/main/CONTRIBUTING.md) before opening the pull request - [x] The pull request uses **`develop`** as the base branch - [x] Tests for the changes have been added - [x] All new and existing tests passed ##### Additional steps for pull requests adding a new feature - [ ] An issue describing the proposed change exists - [ ] The pull request includes a link to the issue - [ ] The change was discussed and approved in the issue - [ ] Docs have been added / updated
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.
Add multiplatform system configuration and secrets readers with JVM-specific implementation
Introduce
SystemConfigReaderandSystemSecretsReaderinterfaces to standardize access to configuration values and secrets across different platforms. This change utilizes theexpect/actualmechanism to define common contracts with specific platform implementations.NotImplementedErrorwhen accessed.UserDefaultsSystemConfigReaderbacked by Apple's NSUserDefaults for retrieving configuration properties. UpdatesystemConfigReaderto use this implementation and introduce comprehensive unit tests to ensure correctness.Motivation and Context
Should be used in Debugger Config and LLM Clients
See also #1228
Breaking Changes
No
Type of the changes
Checklist
developas the base branchAdditional steps for pull requests adding a new feature