Skip to content

Commit

Permalink
Kotlin Override section extended with new Settings option. (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
novalisdenahi authored Dec 20, 2023
1 parent b2afce8 commit dc4206a
Showing 1 changed file with 39 additions and 0 deletions.
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

0 comments on commit dc4206a

Please sign in to comment.