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.

gRPC limits and keepalive v3.19.0

Sizes accept a K/M/G suffix or plain bytes. Defaults reproduce the values used before these variables existed, so an unset environment changes nothing.

VariableDefaultDescription
GRPC_MAX_RECV_MSG_SIZE4MLargest accepted inbound message. A client sending more gets RESOURCE_EXHAUSTED.
GRPC_MAX_SEND_MSG_SIZE0Largest outbound message; 0 means unlimited.
GRPC_KEEPALIVE_TIME30sIdle period before the server pings the client.
GRPC_KEEPALIVE_TIMEOUT10sHow long to wait for a ping reply before closing the connection.
GRPC_KEEPALIVE_MAX_CONNECTION_IDLE5mClose a connection idle for this long.
GRPC_KEEPALIVE_MAX_CONNECTION_AGE30mClose a connection this old, regardless of traffic.

These apply to the gRPC port only. The ConnectRPC/gRPC-web gateway caps a frame at 4 MiB independently, so raising GRPC_MAX_RECV_MSG_SIZE does not lift the limit for gateway traffic.

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.
CORS_ALLOWED_ORIGINS*Origins allowed to call the admin API and the gateway. Also decides which origins may reach /api/mcp: a browser origin that is neither loopback nor listed here is refused.
CORS_ALLOWED_METHODSGET,POST,DELETE,PATCHMethods allowed for cross-origin requests.

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).
CONNECT_REQUIRE_PROTOCOL_VERSION v3.19.0falseReject Connect requests without Connect-Protocol-Version: 1 (or ?connect=v1 on GET) with 400.

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.

Removed in v3.20.0

The CONNECTRPC_HOST / CONNECTRPC_PORT / CONNECTRPC_ADDR and CONNECTRPC_TLS_* fallbacks are gone. Use the GATEWAY_* variables above.

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.