FTF-101
Toggles
A switch in your code, decided while it runs
- A feature toggle is a named switch your code checks before running something new — the new code ships turned off, and goes live when the toggle says so.
- Every toggle has a switch: on or off. It's changed in FTF, not in the code — no redeploy, and it can be switched off again in seconds if something goes wrong.
- A toggle can also have attributes: which customers it's on for — only brands A and B, only claims over $10,000. Your code passes what it knows; the toggle decides (business scenarios).
- Its name says who owns it: your company's prefix, the application, the toggle —
acme.web.new_checkout. - The code asks the same way everywhere. Each environment's own switches and attributes give the answer.
if (await ftf.isEnabled("acme.web.new_checkout", { brand })) {
showNewCheckout(); // the new feature
} else {
showCheckout(); // what customers have today
}
if is_enabled(FTF_URL, CLIENT_KEY, "acme.web.new_checkout", {"brand": brand}):
show_new_checkout() # the new feature
else:
show_checkout() # what customers have today
if (Ftf.isEnabled("acme.policy.new_quote", {"brand" -> brand})) {
showNewQuote() // the new feature
} else {
showQuote() // what customers have today
}
Try it — one toggle
acme.web.new_checkout
switch
attribute: brand = brandA, brandB