Moving Your Toggle Configuration Into a Service
A toggle is a software switch that has two states: on or off. You’ll find them in any system that has a list of options. For example, the Caps Lock and Num Lock keys on a keyboard are toggles that activate specific functionality, and when you press them again they turn off those functions. The word toggle can also refer to hardware such as cordlock toggles, used to stop the drawstring on a rope or cord.
Managing toggle configuration through static files is fine up to a point but as the scale of your deployment grows it becomes cumbersome. Ensuring consistency across a fleet of servers is challenging, and changing configuration on demand can be a major pain in the crotch. For these reasons savvy teams tend to move their Toggle Configuration into some type of service.
This is particularly true of Ops Toggles that need to be managed at a large scale. However, even for this type of toggle it is still better to use a more dynamic approach than simply hardcoding a flag in code.
One way of doing this is to utilize an existing service that supports runtime configuration. This means that you can override the configured state of a service by sending it an override request. This is a fairly robust solution and allows you to dynamically re-configure a specific service instance on demand. This is not without its downsides though: it can increase the cycle time of your CI/CD pipeline and makes it a bit more difficult to test and debug.