What Is a Toggle?
In computing and hardware, a toggle is a switch that has two outcomes. For example, the Caps Lock and Num Lock keys on a keyboard are toggles.
The word toggle is derived from the 18th century term toggle, meaning “pin passed through the eye of a rope.” It’s used today for a variety of fasteners. Toggle is also the name of an up-and-down switch, like a light switch, on some devices.
Managing Toggle Configuration
One common approach to handling toggle configuration is through static files. While this is a simple and effective way to manage toggles, it can become cumbersome as the number of feature flags grows. This is especially true when you need to maintain consistent configuration across a fleet of servers.
Another approach is to move the toggle configuration into some sort of centralized store. This can be as simple as an application DB or a more sophisticated endpoint exposed to the system that allows for dynamic in-memory re-configuration of feature flags.
Testing Feature Toggles
A very common practice for many teams is to test the toggle configurations that will eventually be flipped On in production as well as the fall-back configuration where those toggles are flipped Off. This is to ensure that the toggles don’t cause any surprises or unexpected regressions in future releases.
Some teams go further and create expiration dates on their feature flags to make sure they’re not stuck in production after a set time period. These date ranges can be very useful to detect features that need a little extra love, but they’re also an easy way for a team to see which toggles are no longer required.