Skip to content

Environment Variables

GripMock reads configuration from environment variables on startup.

Core

VariableDefaultDescription
LOG_LEVELinfoLog level (trace, debug, info, warn, error).
MAX_NESTING_DEPTH256Max message nesting depth during stub matching (safety net for circular refs).

gRPC server

VariableDefaultDescription
GRPC_NETWORKtcpNetwork type for gRPC listener.
GRPC_HOST0.0.0.0gRPC bind host.
GRPC_PORT4770gRPC bind port.
GRPC_ADDR$GRPC_HOST:$GRPC_PORTFull gRPC bind address.

HTTP admin server

VariableDefaultDescription
HTTP_HOST0.0.0.0HTTP bind host (admin API + UI).
HTTP_PORT4771HTTP bind port.
HTTP_ADDR$HTTP_HOST:$HTTP_PORTFull HTTP bind address.

Gateway server v3.17.0

The gateway serves both ConnectRPC and gRPC-web protocols on a single HTTP port. Content-Type negotiation dispatches to the correct handler automatically.

VariableDefaultDescription
GATEWAY_HOST0.0.0.0Gateway bind host.
GATEWAY_PORT4769Gateway bind port.
GATEWAY_ADDR$GATEWAY_HOST:$GATEWAY_PORTFull gateway bind address.
GATEWAY_TLS_CERT_FILE(empty)Gateway server TLS certificate file.
GATEWAY_TLS_KEY_FILE(empty)Gateway server TLS private key file.
GATEWAY_TLS_CLIENT_AUTHfalseRequire client certs for gateway (mTLS).
GATEWAY_TLS_CA_FILE(empty)CA file for validating gateway client certs.
GATEWAY_TLS_MIN_VERSION1.2Minimum TLS version (1.2, 1.3).

The gateway provides unary and streaming RPC support for both protocols over HTTP/1.1 and HTTP/2 (with or without TLS). It shares the same stub storage, descriptor registry, and history store as gRPC and REST servers.

Legacy aliases (deprecated)

The following CONNECTRPC_* variables are still supported as fallbacks when the corresponding GATEWAY_* variable is not set:

DeprecatedUnified
CONNECTRPC_HOSTGATEWAY_HOST
CONNECTRPC_PORTGATEWAY_PORT
CONNECTRPC_ADDRGATEWAY_ADDR
CONNECTRPC_TLS_CERT_FILEGATEWAY_TLS_CERT_FILE
CONNECTRPC_TLS_KEY_FILEGATEWAY_TLS_KEY_FILE
CONNECTRPC_TLS_CLIENT_AUTHGATEWAY_TLS_CLIENT_AUTH
CONNECTRPC_TLS_CA_FILEGATEWAY_TLS_CA_FILE
CONNECTRPC_TLS_MIN_VERSIONGATEWAY_TLS_MIN_VERSION

These aliases will be removed in a future release. Migrate to GATEWAY_* variables.

Stub watcher

VariableDefaultDescription
STUB_WATCHER_ENABLEDtrueEnable automatic file watch/reload for stubs.
STUB_WATCHER_INTERVAL1sPolling interval for timer-based watcher.
STUB_WATCHER_TYPEfsnotifyWatcher backend (fsnotify, timer).

History

VariableDefaultDescription
HISTORY_ENABLEDtrueEnable call history recording.
HISTORY_LIMIT64MIn-memory history size cap.
HISTORY_MESSAGE_MAX_BYTES262144Max stored payload size per message.
HISTORY_REDACT_KEYS(empty)Comma-separated keys to redact in history.

Session GC

VariableDefaultDescription
SESSION_GC_INTERVAL30sSession cleanup loop interval.
SESSION_GC_TTL60sSession time-to-live.

Plugins

VariableDefaultDescription
TEMPLATE_PLUGIN_PATHS(empty)Comma-separated paths to template plugins.

gRPC TLS

VariableDefaultDescription
GRPC_TLS_CERT_FILE(empty)gRPC server TLS certificate file.
GRPC_TLS_KEY_FILE(empty)gRPC server TLS private key file.
GRPC_TLS_CLIENT_AUTHfalseRequire client certs for gRPC (mTLS).
GRPC_TLS_CA_FILE(empty)CA file for validating gRPC client certs.
GRPC_TLS_MIN_VERSION1.2Minimum TLS version (1.2, 1.3).

HTTP TLS

VariableDefaultDescription
HTTP_TLS_CERT_FILE(empty)HTTP server TLS certificate file.
HTTP_TLS_KEY_FILE(empty)HTTP server TLS private key file.
HTTP_TLS_CLIENT_AUTHfalseRequire client certs for HTTP (mTLS).
HTTP_TLS_CA_FILE(empty)CA file for validating HTTP client certs.
HTTP_TLS_MIN_VERSION1.2Minimum TLS version (1.2, 1.3).

OpenTelemetry

VariableDefaultDescription
OTEL_ENABLEDfalseEnable OpenTelemetry export.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317OTLP collector endpoint.
OTEL_EXPORTER_OTLP_INSECUREtrueUse insecure OTLP transport.

Buf Schema Registry (BSR)

Supported profiles:

  • BSR_BUF_*
  • BSR_SELF_*

Variables per profile:

Variable suffixDefaultDescription
BASE_URL(empty)BSR API base URL.
TOKEN(empty)BSR token (private modules).
TIMEOUT5sBSR request timeout.

Examples:

  • BSR_BUF_BASE_URL, BSR_BUF_TOKEN, BSR_BUF_TIMEOUT
  • BSR_SELF_BASE_URL, BSR_SELF_TOKEN, BSR_SELF_TIMEOUT

Notes for CLI utilities

dump

gripmock dump reads HTTP_ADDR for the admin API host/port.

  • Default scheme is http. Use --scheme https for TLS.
  • Override address via env: HTTP_ADDR=10.0.0.5:4771 gripmock dump.