Feature toggles (otherwise known as feature flags or feature switches) are a software development technique that provides a way of turning functionality or display on and off during runtime, without deploying new code. This allows for more control and experimentation over the full lifecycle of features. Feature toggles are a best practice in DevOps, often occurring within distributed version control systems.
Foo's feature toggle makes it easy to create, access and manage feature toggles from a web UI and REST API. This post will cover how to get started with Toggle Tools, create environments and create toggles.
Step 1: Create an Account
In order to get started, you'll need to choose a plan and create an account. If you want to just try things out, don't worry - each plan offers a one month free trial that you can cancel anytime without being charged.
Step 2: Create Environments
Environments are typically used for testing or "development" purposes. A website or application may have a "staging" or "development" environment and Toggle Tools environments can be used to match. You may want to toggle features on in a lower environment while being developed. Each toggle will exist in all environments, but can be toggled on or off independently. You can easily create and manage environments in the dashboard. You may only have one environment, which is totally fine!
Step 3: Create Toggles
In the dashboard you can create and manage toggles. Once you've created a toggle, you can drill into any environment and toggle it on or off. You can also click into toggle settings of any specific environment by clicking the arrow of the toggle item within the environment toggle list.
Step 4: Toggle Configuration
In the dashboard you can expand any environment to find a list of toggles. By clicking the arrow icon of any toggle you'll be navigated to a detail screen where you view and manage settings. Below is a list of settings and a description of each.
- Origin: If you're using the REST API to get the toggle state, either this setting must be configured or an API token must be used. REST API documentation can be found here.
- Split Traffic: Your toggle doesn't have to be only either on or off. You can can choose a percent of traffic to serve it toggled on. This must be a number (percent toggled on) between 1 and 100.
- Gradual Rollout: This setting allows you to roll out a feature gradually over time. To use this option you'll need to set a start date, end date, start percent and end percent. The start date and end date is the span of time encompassing the roll out. The start percent will typically be 0 and end percent 100, but these values are configurable. On the end date, the toggle will be toggled on for the percent of traffic set in end percent and any date thereafter.
Step 5: Toggle in Code Implementation
At this point we're ready to start using our new toggle 🙌 Developers can use the REST API to implement toggles in code. REST API documentation provided here.