Manage feature flags backed by Redis for canary releases and kill-switches.
# List all feature flags and their current state
nself flag list
# Enable a feature flag
nself flag set new-checkout true
# Read a single flag
nself flag get new-checkoutnself flag list [FLAGS]
nself flag get <NAME> [FLAGS]
nself flag set <NAME> <VALUE> [FLAGS]
nself flag history [NAME] [FLAGS]nself flag manages feature flags stored in Redis. Flags are string-keyed boolean or string values that your application reads at runtime via the Hasura GraphQL API or the nSelf SDK. Because they live in Redis, changes take effect immediately — no rebuild or redeploy required.
Flags are used for canary releases (enable a feature for a subset of users via application logic), kill-switches (disable a misbehaving feature without a deploy), and A/B toggles. The flag system itself is kept minimal by design: it stores key-value pairs. Percentage rollout, user targeting, and other advanced logic are implemented in application code.
Flag changes are appended to an immutable audit log in Redis. Usenself flag history to see who changed a flag and when.
Print all flags, their current values, and the last modified timestamp.
nself flag list
# NAME VALUE LAST MODIFIED
# new-checkout true 2026-05-07 09:12 UTC
# dark-mode false 2026-04-30 14:00 UTC
# api-rate-limit 500 2026-05-01 08:00 UTCPrint the current value of a single flag. Exits with code 1 if the flag does not exist.
nself flag get new-checkout
# true
nself flag get new-checkout --json
# {"name":"new-checkout","value":true,"updated_at":"2026-05-07T09:12:00Z"}Create or update a flag. VALUE is parsed as a boolean (true/false) or left as a string for non-boolean flags.
# Boolean flag
nself flag set new-checkout true
nself flag set maintenance-mode false
# String flag (useful for A/B variant names)
nself flag set homepage-variant control
# Numeric string
nself flag set api-rate-limit 1000Show the change history for a specific flag, or for all flags if NAMEis omitted. Entries include timestamp, old value, new value, and the actor (CLI user or API key that made the change).
nself flag history new-checkout
# TIMESTAMP OLD NEW ACTOR
# 2026-05-07 09:12 UTC false true aric@example.com
# 2026-04-30 12:00 UTC <new> false aric@example.com
nself flag history # all flags| Flag | Type | Default | Description |
|---|---|---|---|
--json | bool | false | Output as JSON |
--env | string | active | Target environment: local, staging, prod |
--limit | int | 50 | Max history entries to return |
# Deploy the code with the flag-gated feature
nself flag set new-payments false
# When ready to enable:
nself flag set new-payments truenself flag set recommendation-engine false --env prod
# Application checks this flag and disables the feature immediatelynself flag history --json | jq '[.[] | select(.timestamp > "2026-05-01")]'VALUE=$(nself flag get maintenance-mode --env prod)
if [ "$VALUE" = "true" ]; then
echo "Site is in maintenance mode — skipping smoke tests"
exit 0
finself flag list --env prod --jsonNSELF_ENV — default target environment when --env is not specifiedREDIS_URL — override the Redis connection used for flag storage0 — success1 — generic error (Redis unreachable, flag not found)2 — invalid arguments