CLI Reference

All CLI commands and flags

Overview

SBproxy ships as a single binary called sbproxy (aliased as sb). All configuration is done through the config file. The CLI handles starting, validating, and inspecting your setup.

Global Flags

FlagDescription
-h, --helpShow help for any command
-V, --versionPrint the version and exit

sbproxy serve

Start the proxy server. This is the primary command.

sbproxy serve [flags]
FlagEnv VarDefaultDescription
-f, --configSB_CONFIG_FILEPath to the sb.yml config file. The path must be supplied; the binary does not auto-discover a config in the working directory. A bare positional path also works: sbproxy sb.yml.
--log-levelSB_LOG_LEVELinfoLog filter. Accepts a bare level (debug, info, warn, error) or a per-target filter.
--request-log-levelSB_REQUEST_LOG_LEVELunsetIndependent filter for the access log.
--log-formatSB_LOG_FORMATcompactLog output format: compact, pretty, or json.
--shutdown-grace-msSBPROXY_SHUTDOWN_GRACE_MS30000SIGINT/SIGTERM drain budget in milliseconds. Supersedes the legacy --grace-time / SB_GRACE_TIME.
--disable-sb-flagsSB_DISABLE_SB_FLAGSfalseLock off the per-request feature-flag surface (X-Sb-Flags header and _sb.* query params). Recommended for production.

Examples

# Start with a config file (positional or via -f)
sbproxy sb.yml
sbproxy serve -f /etc/sbproxy/sb.yml

# Debug logging with JSON output
sbproxy serve -f sb.yml --log-level debug --log-format json

# Production: lock off the per-request debug flags
sbproxy serve -f sb.yml --disable-sb-flags

sbproxy validate

Validate the config file without starting the server. Exits with code 0 if the config is valid, or code 1 if errors are found.

sbproxy validate [flags]

Examples

# Validate a config file (exit 0 on success)
sbproxy validate sb.yml

# Diff a config against a baseline before rollout
sbproxy plan -f sb.yml --against baseline.yml

sbproxy version

Print the SBproxy version and exit.

sbproxy --version

Environment Variables

Every CLI flag has a corresponding environment variable. Environment variables take precedence over defaults but are overridden by explicit flags.

VariableEquivalent Flag
SB_CONFIG_FILE-f, --config
SB_LOG_LEVEL--log-level
SB_REQUEST_LOG_LEVEL--request-log-level
SB_LOG_FORMAT--log-format
SBPROXY_SHUTDOWN_GRACE_MS--shutdown-grace-ms
SB_GRACE_TIME--grace-time (legacy)
SB_DISABLE_SB_FLAGS--disable-sb-flags