Skip to content

[DOC] Add flag configurations recipes #309

Closed

Description

@beeme1mr

Change in the documentation

Overview

Flag configurations are powerful but may be intimidating for new users. A list of some sample configurations (or recipes) ordered from basic to complex that show realistic use cases would help provide a solid understand of what's possible.

Examples

The following examples can be used as a starting point for how the doc may be structured.

Basic

A boolean flag that's enabled for everyone

{
  "flags": {
    "myBoolFlag": {
      "state": "ENABLED",
      "variants": {
        "true": true,
        "false": false
      },
      "defaultVariant": "true"
    }
}

Intermediate

A boolean flag that's enabled only for specific companies.

{
  "flags": {
    "myBoolFlag": {
      "state": "ENABLED",
      "variants": {
        "true": true,
        "false": false
      },
      "defaultVariant": "false",
	  "targeting": {
  		  "in": [ { "var": "company" }, ["Hooli", "Acme", "Initech"]]
      }
    }
}

NOTE: This targeting rule will returns a boolean, which happens to match a variant name.

Advanced

Sudo randomly return a color based on the browser

{
  "flags": {
    "headerColor": {
      "variants": {
        "red": "#FF0000",
        "blue": "#0000FF",
        "green": "#00FF00"
      },
      "defaultVariant": "red",
      "state": "ENABLED",
      "targeting": {
        "fractionalEvaluation": [
          "browser",
          [
            "red",
            50
          ],
          [
            "blue",
            20
          ],
          [
            "green",
            30
          ]
        ]
      }
    }
  }
}

NOTE: See fraction evaluation for more information.

Activity

  1. added
    documentation
    Needs Triage
    on Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Triagedocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions