Skip to main content

Overview

If you gate features with checks like process.env.FEATURE_NEW_CHECKOUT === "true", each variable maps to a flag. In this guide you replace one with the boolean flag new-checkout, keep the variable as the SDK default while you migrate, then delete it.

Map variables to flag types

Per-deploy values (.env.staging, .env.production) become per-environment Fallthrough values. Secrets and connection strings stay in environment variables.

Steps

1

Define the flag

2

Push it and match each environment

For each environment where the variable is currently true, open the flag in the dashboard, select the environment, set Fallthrough to true, and click Save environment. Push sets Fallthrough in the environment you push to from default, and resets it on every push when they differ. If the environment you push to serves true, change default to true in shipd.config.ts (or run shipd pull) before your next push, or the push turns the flag off there. Other environments keep their dashboard value. See Environments.
3

Use the variable as the SDK default

Until shipd serves the flag, the client falls back to defaults. Seed them from the variable so behavior doesn’t change if the edge is unreachable during the switch:
4

Replace the checks

5

Remove the variable

Once every deploy reads the flag, replace the default with a literal ("new-checkout": false) and delete FEATURE_NEW_CHECKOUT from your environments.
Now you can change the value without a redeploy, and target users or roll out by percentage. For Go definition snippets, add the entries to config.ShipdConfig in shipd.config.go before pushing. See Define flags in code.