Skip to content
SHC Docs

Environment variables

Environment variables the Go daemon and CLI actually read. Precedence: env var > config file > default.

Two read paths exist:

  • Direct readsos.Getenv/os.LookupEnv at specific call sites (most rows below).
  • Koanf env mapping — the config loader additionally maps SHC_* vars onto dotted config keys (SHC_FOO_BARfoo.bar), with an explicit override table for keys whose names contain underscores (envOverrideMap, core/config/config.go): SHC_KEYCLOAK_REALMkeycloak.realm, SHC_KEYCLOAK_CLIENT_IDkeycloak.client_id, SHC_KEYCLOAK_CLIENT_SECRETkeycloak.client_secret, SHC_INTERNAL_API_BINDinternal_api.bind (plus SHC_LOG_LEVEL/SHC_LOG_FORMAT below). A grep for os.Getenv alone misses these.
VariablePurposeDefault
SHC_BASE_DIRBase directory (root of all SHC paths)auto
SHC_STATE_HOMEState directoryXDG default
SHC_CACHE_HOMECache directoryXDG default
SHC_RUNTIME_DIRRuntime directoryXDG default
SHC_LOGS_DIRLogs directoryXDG default
SHC_TMP_DIRTemp directoryauto
SHC_DATABASE_PATHDatabase pathauto
SHC_SOCKET_PATHUnix socket pathauto
SHC_PID_PATHPID file pathauto

Default resolution context for CLI commands.

VariablePurposeDefault
SHC_TENANTDefault tenantdefault
SHC_ENVIRONMENTDefault environmentdefault
SHC_STACKDefault stack
VariablePurpose
SHC_HOSTPublic host of this SHC install; keycloak/OTEL URLs derive from it.
SHC_PORTPublic listener port.
SHC_URLServer URL the CLI client connects to.
SHC_ADVERTISE_ADDRAddress this node advertises to cluster peers.
SHC_INTERNAL_TOKENShared token for the internal (peer/LAN) API listener.
SHC_UDS_GROUPUnix-domain-socket owning group (who may talk to the daemon locally).
SHC_RQLITE_BIND_ADDRIPv4 the raft engine (rqlited) binds and advertises (cluster mode).
SHC_RQLITE_HTTP_ADDRrqlited HTTP API bind address override (cluster mode).
SHC_RQLITE_RAFT_ADDRrqlited raft bind address override (cluster mode).
SHC_RQLITED_BINPath to the rqlited binary (else PATH, then the packaged path).
SHC_NODE_PUBLIC_ADDRESSOperator override for this node’s detected public address (recorded on the node row; wins over cloud-metadata detection).
SHC_INTERNAL_API_BINDKoanf mapping for internal_api.bind — the internal (peer/LAN) API listener address.
VariablePurposeDefault
SHC_DEVDev mode when 1 (also SHC_MODE=dev).off
SHC_MODEdev enables dev mode.
SHC_LOG_LEVELLog level (debug/info/warn/error).info
SHC_LOG_FORMATLog format (e.g. json, text).auto
SHC_OUTPUTCLI output format (tty, json, …).tty
SHC_FIELDS / SHC_FILTER / SHC_EXCLUDECLI output field shaping / row filtering.
SHC_DEBUGCLI debug mode (same as --debug/-d).off
SHC_VERBOSECLI verbose output (same as --verbose/-v).off

All vault-resolvable; these seed the value when set directly.

VariableConfig equivalentPurpose
SHC_VAULT_PASSWORDUnlock the local vault at startup.
SHC_BACKUP_REPObackup.repoRestic repository.
SHC_BACKUP_PASSWORDbackup.passwordRestic repository password.
SHC_KEYCLOAK_REALMkeycloak.realmKeycloak realm override (koanf mapping).
SHC_KEYCLOAK_CLIENT_IDkeycloak.client_idKeycloak admin client id (koanf mapping).
SHC_KEYCLOAK_CLIENT_SECRETkeycloak.client_secretKeycloak admin client secret (koanf mapping).
SHC_CLIENT_IDCLI-only: confidential client id for shc auth --client-credentials (with SHC_CLIENT_SECRET). Not a config override — use SHC_KEYCLOAK_CLIENT_ID for that.
SHC_CLIENT_SECRETCLI-only: confidential client secret for the --client-credentials grant.
VariablePurpose
SHC_MODULESOverride the set of system apps deployed at init (empty = none).
SHC_BUNDLED_APPS_DIRSExtra directories scanned for bundled app definitions.
SHC_NODE_LOCATIONFree-form location label for this node.
SHC_COMPOSE_NO_WAIT / SHC_STACK_NO_WAITSkip --wait convergence on compose/stack ops.
SHC_INSTALL_POLL_MSInstall progress poll interval (ms).
SHC_HOSTRUNalways / never — override the host-run probe for storage host commands (tests, unusual hosts).

SHC_HUD_TOKEN, SHC_HUD_BEARER, SHC_HUD_EXEC, SHC_HUD_DEBUG configure the terminal HUD’s auth and debug behavior.

SHC_TEST_DB_URL, SHC_TEST_LIB, SHC_TEST_TMP_ROOT, SHC_SYSTEM_RUN (hermetic override for the system runtime dir), SHC_COMPLETION_DEBUG, SHC_COMPLETION_TIMEOUT are used by the test/dev harness and shell completion.

SHC respects the XDG Base Directory Specification for non-root path defaults:

  • XDG_CONFIG_HOME (default: ~/.config) — config file directory
  • XDG_DATA_HOME (default: ~/.local/share) — state directory
  • XDG_CACHE_HOME (default: ~/.cache) — cache directory
  • XDG_RUNTIME_DIR (no default) — runtime directory