Hey kids! Remember how we've discussed how import it is to use feature flags in your code? Let's discuss how to set up feature flags using one of the tools available. To my knowledge, LaunchDarkly is not free at any level and is generally used on an enterprise (company) account. So if you are going to use it, it will most likely be through your employer purchasing a plan.
Let's go though adding new feature flags using Launch Darkly.
For more info on Launch Darkly itself, go to https://launchdarkly.com/ for high level details, and to https://docs.launchdarkly.com/home/getting-started for documentation on how to get started in other languages. We will discuss how to do a setup in .NET below.
As an organization member, you will need to be invited by a user or admin to have an account. For more information on getting an invitation, please contact your organization's account administrator.
Log into https://app.launchdarkly.com/ and you should see something like this:
To navigate to the different project / environment options, click on the carrot in the top left area (in the screenshot, it's yellow)
Scroll down the project list on the left, to the project you want. This should already be set up for you by your administrator. Then choose the environment you want to view.
to create a new feature flag, on the far right, click the Create Flag button to begin.
Name your flag and fill out any tags or other details you want to add.
Determine the variation you want to use, both Boolean and String options will be shown in our examples below.
For your string variations , add a text value to pass into the code when the flag is turned on or off. Verify the default variation and click 'save'.
NOTE: All values except the name and variation type can be changed later
Once the flag is created, turn it on in the environment you're interested in setting up, such as dev or test.
Now, go to the Account Settings (left tree, bottom) and note the project you are in.
Search for the project and click the project name.
Find the SDK keys for each environment. Copy the values and save all environments for your project usage.
Move to your code and install the current Launch Darkly package.
On the page you want to use Launch Darkly, add the using statements below.
Next, in the code add the sdkKey, Flagkey, and the ldClient. Create the anonymous user and then connect to your flag, based on the bool or string values. Below is the string option.
You should be able to then run your code and see the string value you specified in your flag that is on.
The below example is for the Boolean option
The below option is the string setup
Example code repo used for the demo: https://github.com/launchdarkly/hello-dotnet
And that's it!! Let me know if you run into any issues while setting up your flags.