Learning to implement switches within LaunchDarkly
To implement a switch within your application, you only need to encapsulate a feature within a Boolean feature flag, as we saw in Chapter 3, Basics of LaunchDarkly and Feature Management. There is nothing new when it comes to the actual implementation of making use of an if
statement to offer two pieces of functionality based on what value LaunchDarkly is configured to serve; that is, either true
or false
. However, it is designed to always be within your application. You may not need to make any changes to how you would implement a flag, but there might be additional documentation or abstractions within your code to provide greater context about the long-lived flag within the application.
It is worth considering how you want to work with the default value of the feature flag within your application. So far, we have only ever considered the default value to be false
if LaunchDarkly can't be unreached by your application. However...