Many of our users wonder about some of the various ways you can search for feature flags across different environments within a project. It’s a common question—and there’s actually more than one way to do it.
Before showing you how to search, let’s first discuss why this is beneficial.
Why would one need to search for flags across different environments?
One of the main reasons a LaunchDarkly user may want to search for flags across environments is to get a view of different flag targeting states.
Think of LaunchDarkly environments as mapping to infrastructure environments: your project may have a user acceptance testing environment, a staging environment, and a production environment. So, naturally you’d want to have an efficient way to view those different targeting rules because each one of those environments may have that feature turned either on or off, or targeted slightly differently.
How does being able to search these flags help during development?
Even if you're not adding a new feature, sometimes you may want to see the functionality of a module, library, or chunk of code to find out what other feature flags already exist there. This can give you an understanding of where the runtime control is.
You can search by either name or tag to see if there are existing flags that are similar or related to any new features you may be implementing. You may also want to see how other similar features are tagged so you can keep track of them in the future.
From a product management perspective, it's important to be able to view flags across different environments to see which of the features your team is building are turned on—and who they are turned on for. This is rather foundational to the development experience, especially one with LaunchDarkly flags at its core.
Searching for feature flags across environments: the default method
Let’s start with what is essentially the default method. When you open the LaunchDarkly interface, you will automatically see the flag overview page, which is for one single environment.
So, if you're searching for a flag on that page, or you click an individual flag and see the details page, you can go into the top left corner of the navigation and switch to a different environment. You'll still have that same flag visible on the page, but with a different environment now.
There are also a few other features that could be valuable—depending on what the use case is and what the user is looking for across environments. LaunchDarkly has an overview across environments feature that enables you to look at a single flag across different environments. This allows you to gain an overview of the flag targeting state and which variations are being served.
And, if you want to see several flags at once, you also have the ability to compare two environments, as shown above.
Quick Search
Another handy way to search for flags across environments is the quick search feature. There are two ways to access this functionality.
The first is just locating the search/magnifying glass icon in the righthand-side of the top bar. You can then use the quick search function to open a flag. Simply open the quick search, select ‘open flag,’ and then type in the name of that flag to be sent to its details page.
You can also instantly access is functionality by using command + K on a Mac or control + K on a Windows device. This action will open up a quick search pop‑up that allows you to quickly access different parts of the app.
Within that view, you’ll also find an option to switch environments. So, if you are already looking at a particular flag, you can quickly hit command + K or control + K and switch environments to view that same flag in another environment.
Configurable Filters
Want to get a little more specific with your search? Flags can also be searched for by using the interface’s configurable filters.
You can search within an environment by using a number of different filters, such as tags, maintainer status, evaluated type, and so on.
Searching for flags via API
If you get a feature flag via the API, that flag will have all of the environment data embedded for each specific environment with that single call. You can set the summary to false, which sends back information. Otherwise, the feature flag does have a summary section that contains high‑level information.
Do you have a question you haven’t seen covered in this series yet? Feel free to reach out and let us know.