Lab E - Feature Flags
Lab 5 - Feature Flags
Summary: Build and deploy your first feature flag
Learning Objective(s):
-
Create a Feature Flag
-
Create an SDK key
-
Deploy application that uses Flag/SDK Key
-
Toggle Feature Flag to enable/disable feature
Steps
Create the SDK Key
-
From the left hand side menu under Feature Flags, select environments
-
From the list select the prod environment
-
Click + New SDK Key, configure as follows and click Create
| Input | Value | Notes |
|---|---|---|
| Name | dk | |
| Key Type | client |
-
Copy the secret to use later. Note that the key will be redacted once you leave the page.
-
From the left hand side menu select Project settings
-
From the resources available click on the Variables
-
Modify the sdk variable and copy in the key
| Input | Value | Notes |
|---|---|---|
| Name | sdk | |
| Value | SDK Key copied from previous step |
- Click Save
Create the Flag
-
From the left hand menu, go to Feature Flags → Feature Flags
-
Click + New Feature Flag, configure as follows and click Save and Close.
| Input | Value | Notes |
|---|---|---|
| Type | Boolean | |
| Name | webinarff | |
| Variation Settings | ||
| Name (first one) | Show Offer | |
| Name (second one) | Hide Offer | |
| If the flag is Enabled, serve | Show Offer |
-
Enable the flag by clicking on the Flag is Disabled button and click Save
-
Run the pipeline created in previous steps
Change the Flag via the UI
-
From the left hand menu in Harness, go to Feature Flags → Target Management
-
Select the target shown in the list. If target is not shown, create the target manually
| Input | Value | Notes |
|---|---|---|
| Name | webinar | |
| Identifier | webinar |
-
Click Add Flag, toggle webinarff, set the variation to Show Offer, then click on Add 1 Flags
-
Note that your application now displays a special offer
-
For your target, set the variation to Hide Offer and click Save Chances
-
Note that your application now does NOT display the special offer