Download this file
| 1 | // Package rollout is the box's rollout scheduler (zero-downtime deploys spec |
| 2 | // §6, §8, §10). It decides which instance moves to which build, when, in which |
| 3 | // swap mode, and what happens when a build fails. It is armed only by |
| 4 | // CARLOS_SWAP=overlap. With the flag unset nothing in this package runs, and |
| 5 | // the box keeps today's stop-then-wake paths. |
| 6 | package rollout |
| 7 | |
| 8 | import "strings" |
| 9 | |
| 10 | // SwapEnv is the box flag (spec §15). |
| 11 | const SwapEnv = "CARLOS_SWAP" |
| 12 | |
| 13 | // Enabled reports whether the box flag arms the scheduler. Only the exact |
| 14 | // word "overlap" does: a typo must leave the box on today's paths, not on a |
| 15 | // half-understood new one. |
| 16 | func Enabled(getenv func(string) string) bool { |
| 17 | return strings.TrimSpace(getenv(SwapEnv)) == "overlap" |
| 18 | } |
| 19 | |