Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin Override section extended with new Settings option. #343

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions website/docs/sdk-reference/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ Moreover, you can specify how the overrides should apply over the downloaded val

- **Remote over local** (`OverrideBehavior.REMOTE_OVER_LOCAL`): When evaluating values, the SDK will use all feature flags & settings that are downloaded from the ConfigCat CDN, plus all feature flags & settings that are loaded from local-override sources. If a feature flag or a setting is defined both in the downloaded and the local-override source then the downloaded version will take precedence.

### Map

You can set up the SDK to load your feature flag & setting overrides from a `Map<String, Any>`.

```kotlin
Expand All @@ -399,6 +401,43 @@ val client = ConfigCatClient("localhost") {
}
```

### Settings

You can set up the SDK to load your feature flag & setting overrides from a `Map<String, Setting>`.

```kotlin
val client = ConfigCatClient("localhost") {
flagOverrides = {
behavior = OverrideBehavior.LOCAL_ONLY
dataSource = OverrideDataSource.settings(
mapOf(
"noRuleOverride" to Setting("noRule", 1, emptyList(), emptyList(), "myVariationId"),
"ruleOverride" to Setting(
"noMatch",
1,
emptyList(),
listOf(
RolloutRule("ruleMatch", "Identifier", 2, "@example", "ruleVariationId")
),
"myVariationId"
),
"percentageOverride" to Setting(
"noMatch",
1,
listOf(
PercentageRule("A", 75.0, "percentageAVariationID"),
PercentageRule("B", 25.0, "percentageAVariationID")
),
emptyList(),
"myVariationId"
)
)
)
}
}
```


## `getAllKeys()`

You can query the keys of each feature flag and setting with the `getAllKeys()` method.
Expand Down