blog post banner image

Feature Flags and Environments

Ann McArthur

7/16/2023

Feature Flags and Environments

Using feature flags is a key part of having a modern software development process. Being able to track the status of your new code and release it when you’re ready can help with hygiene, testing, and showing changes to individual users or stakeholders in your company.

Originally, feature flags worked as a boolean where you would turn them on or off to reveal a feature. However, feature toggling has grown to become more complex, offering you more options for how to control your feature. This is where dynamic feature flags come in.

In general, the concept of feature flags relies on if statements/boolean logic. Development teams are always going to have to evaluate if a feature should be on or off. The code that toggles a feature on or off used to live alongside the feature code, with dynamic feature toggling can be done without making any changes to code since the feature flags are controlled externally.

Dynamic feature flags allow developers to use if statements rather than the original hard-coded flags. Companies like DevCycle come in to help solve the complexities that come with dynamic feature flags. This includes providing a single interface to manage and maintain your flags, being able to retrieve them quickly, and dividing user traffic to more than one feature.

What is an Ephemeral Environment?

While managing your feature flags is important, you also need to ensure you have several testing environments. This can pose a challenge to feature flags if you have ephemeral environments which are temporary, unlike a production and staging environment.

Ephemeral environments don’t last for a long time and are removed after a short period of time. They can last as long as the CI/CD lifecycle, or up to a week but their unique and distinguishing factor is that they are temporary. They can also be known as dynamic, temporary, or on-demand environments. Ephemeral environments are automated, can be shared, and have replicated data. While this environment is around for a short period of time, they are still complex and the temporary setup can complicate the management of your feature toggles.

How Feature Flag Environments Help

DevCycle has environments in its application with APIs that allow you to control sets of feature flags for new feature releases on an environmental basis. This is a great solution if you have a limited set of environments that don’t change frequently. 

In order to make this process less complex, it’s common for engineering teams to create two environments. One for testing with internal users, and another for production. Larger companies may include more environments such as development, uat and staging. These solutions work as long as you don’t fully move towards an ephemeral environment.

​​Ephemeral Environments

The problem is that once companies fully dive into using ephemeral environments, they tend to take shortcuts by simply giving each ephemeral environment to a single feature flag environment. While this reduces complexity, it creates the issue of people working over each other. If you toggle a feature on, a team member could easily toggle it off. While the ability to toggle feature flags is a benefit, if every environment is pointing to a single database, people could be stepping on each other's toes.

A way to solve this problem would be to create an environment in DevCycle with a unique attribute to your ephemeral environment. That way, you can ensure a unique SDK API is used within that environment.

Get Started With DevCycle

DevCycle helps you use best practices to create and organize multiple environments so you can keep track of your feature rollouts as they go out to end-users while minimizing technical debt. If you’re looking to get started with feature flags try DevCycle.


Written By

Ann McArthur