Pakkit.net
← Back to blog

Operations

A Runtime Toggle Beats a Redeploy

Some changes are operational levers, not code — draining a site, disabling an endpoint, turning a risky feature off — and for those, a config toggle you can flip and flip back in seconds beats a code change and a deploy every time, as long as you build the toggle to be reversible, stageable, and safe.

  • Operations
  • Automation
  • Configuration
  • Reliability

There’s a category of change that has no business being a code deploy. “Take this site out of rotation.” “Disable that upstream endpoint.” “Turn off the feature that’s misbehaving.” These are operational decisions — you need them now, you’ll probably need to undo them just as fast, and shipping a code change through a build-test-deploy pipeline to make them is both too slow and too heavy. The right shape is a runtime toggle: a config-driven switch an operator flips, that takes effect on the running system, and that flips back exactly as easily. I built one of these for draining service endpoints, and the design lessons generalize well past that one job.

Operational levers should be data, not deploys

A deploy is the right tool for changing what the code does. It’s the wrong tool for a decision an operator makes about the running system’s state — because a deploy is slow, it’s a bigger blast radius than the change deserves, and under pressure “we need to redeploy to drain that site” is a sentence nobody wants to say during an incident. A toggle collapses that to flipping a value and applying it: seconds, not a pipeline. The change lives in configuration and gets read by the running system, so the operational lever is as fast to pull as the situation demands.

If you have to ship code to take a server out of rotation, the server’s already been in rotation too long. Operational state deserves an operational control.

The properties a good toggle needs

A toggle is only trustworthy if it’s built for the moment you’ll actually use it — usually a stressful one. The ones I trust share a few properties:

  • Reversible, with a real rollback. Flipping it off has to be as clean as flipping it on. I back up the prior state before every change and ship a rollback path that restores it, so “undo the last toggle” is a first-class operation, not an improvised scramble.
  • Data-driven, not hard-coded. The original version of the thing I rebuilt had its list of endpoints hard-coded, so adding one meant editing a template — a code change for what should be data. I moved the inventory into a single list that drives everything. Adding or removing a target is now editing data, which is the whole point of a toggle.
  • Stage the change separately from applying it. Writing the new state and making the service act on it are different operations with different risk — so I split them, with a separate switch for “now actually apply it.” You can stage a change safely and activate it deliberately, instead of every edit being an instant service disruption. (That’s the same restart-only-on-change discipline from the other side.)
  • Preview before you commit. A dry run that shows what the toggle would do — which flags change, from what to what — before it does anything, so an operator confirms the intent under pressure.

The safe mode should need no secrets

One design choice I’m especially glad I made: the default, everyday mode of the toggle needs no secrets at all. It surgically flips just the one flag that controls the behavior and touches nothing else — so an operator draining a site isn’t handling credentials to do it. There’s a heavier “re-render everything” mode that does need the sensitive values, but it’s opt-in and it fails fast if those values aren’t supplied, rather than shipping them baked in. The original version had committed real shared secrets right into the config template; pulling those out and making the common path secret-free was both safer and simpler. The lesson: the routine operational action shouldn’t require touching the crown jewels, and defaults shouldn’t carry secrets that end up in the repo.

Toggles are power, so give them guardrails

A runtime toggle is a live control over production behavior, which is exactly why it needs the same seatbelts as any automation with real reach: it’s off by default behind an explicit “yes, apply this” gate, it always backs up before it changes anything, and it’s friendly to preview. Those aren’t friction — they’re what make it safe to hand an operator a lever that changes the running system. It’s the panic-button philosophy applied to a toggle: fast to pull, fast to reverse, hard to fire by accident.

The distinction I carry now: is this a change to what the code does, or a change to how the system is operated right now? The first is a deploy. The second is a toggle — reversible, data-driven, stageable, secret-free in the common case, and guarded. Build those, and a whole class of “we need to ship a fix to change one operational setting” just disappears. If you’ve built runtime toggles that saved you during an incident, I’d love to compare designs.