This page provides practical, copy-paste YAML examples for common Configuration-as-Code (CasC) use cases. You can adapt these examples to your specific needs.
Conditional configurations
Using target groups and version
In the following example, a flag is true only for users in the QA or Beta Users target groups that are using version 3.0.1 (or later) of an application.
Otherwise, the flag value is false and the feature is hidden.
flag: default.followingView type: flags name: following view conditions: - group: name: - QA - Beta Users version: operator: semver-gte semver: 3.0.1 value: true value: false
Target group configurations
A target group is a set of rules on top of custom properties that are defined in runtime and used in flags conditions.
Target using user IDs
Configure a target group matching specific user IDs.
type: target-group name: QA conditions: - operator: in-array property: soundcloud_id operand: - 5c0588007cd291cca474454f - 5c0588027cd291cca4744550 - 5c0588037cd291cca4744551 - 5c0588047cd291cca4744552 - 5c0588047cd291cca4744553
Target using a number property
Configure a target group using a number property for comparison.
type: target-group name: DJ description: Users with over 100 playlists operator: or conditions: - operator: gt property: playlist_count operand: 100
Target group schema
Use the following YAML example as a reference for configuring target groups.
# Yaml api version # Optional: defaults to "1.0.0" version: Semver # Yaml Type (required) type: "target-group" #Target Group Name name: String # Target Group description # Optional = "" description: String # The logical relationship between conditions # Optional = and operator: or|and # Array of Conditions that have a logical AND relationship between them conditions: # The Custom property to be conditioned (first operand) - property: String # The Operator of the confition operator: is-undefined|is-true|is-false|in-array|eq|ne|gte|gt|lt|lte|regex|semver-ne|semver-eq|semver-gte|semver-gt|semver-lt|semver-lte # The Second operand of the condition # Optional - Based on operator (is-undefined, is-true, is-false) operand: String|Number|[String]
Split release configurations
50% traffic split
In the following split release example, a flag value is true for 50% of app users.
For the other 50% of users, the flag value is false, and the feature is hidden.
flag: default.followingView enabled: false defaultValue: - percentage: 60 option: true - percentage: 40 option: false conditions: []
Scheduled release configurations
Configure the percentage of app users who are exposed to a feature at a specified date and time.
Gradual rollout over time
The example below illustrates a rollout transitioning from 0% to 100% over the course of a week, from November 21 to November 28. For example, at 2024-11-21T13:26:00Z, 0% of users will receive true, and by 2024-11-28T13:31:00Z, 100% of users will receive true. Refer to Configure a scheduled release (Boolean only) for more information about configuring a scheduled release.
enabled: false defaultValue: - percentage: 0 from: 2024-11-21T13:26:00Z - percentage: 100 from: 2024-11-28T13:31:00Z conditions: []
Related topics
-
Configuration as code reference - Review technical specifications and schemas
-
Set up configuration as code - Learn how to set up CasC
-
Get started with configuration as code - Understand CasC concepts