Documentation
¶
Overview ¶
Package config loads server configuration from environment variables.
Index ¶
Constants ¶
View Source
const ( // TransportStdio runs the server over stdin/stdout (default). TransportStdio = "stdio" // TransportHTTP runs the server as an HTTP service with bearer-token auth. TransportHTTP = "http" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
DatabaseURL string
Host string
Port int
User string
Password string
SSLMode string
CAPath string
CertFile string
KeyFile string
EnableWriteQueries bool
QueryTimeout time.Duration
MaxRowsCount int64
LogLevel zapcore.Level
LogPath string
MaxConns int32
// TxnQoS is set only when CRDB_MCP_TXN_QOS is explicit. Empty means
// "let the adapter decide" - the adapter respects a DSN-supplied value
// if present, otherwise falls back to its background default.
TxnQoS string
AllowPasswordAuth bool
Transport string
HTTPListenAddr string
BearerToken string
TLSCert string
TLSKey string
AllowInsecureHTTP bool
// AllowNoBearer lets HTTP mode start without a bearer token. Auth must
// then be provided upstream (reverse proxy, gateway, mTLS).
AllowNoBearer bool
// AllowInsecureDB permits the sslmode values that can run without
// TLS (disable, allow, prefer). Local development only.
AllowInsecureDB bool
OTelFile string
OTLPEndpoint string
}
Config holds the server configuration.
func Load ¶
Load reads configuration from environment variables. Two auth modes are supported, in priority order:
- CRDB_DATABASE_URL - a full libpq connection string (preferred when set).
- Cert-based env vars - CRDB_HOST, CRDB_USERNAME, CRDB_SSL_CERTFILE, CRDB_SSL_KEYFILE, and CRDB_SSL_CA_PATH for verify-ca/verify-full.
func (*Config) InsecureDB ¶
InsecureDB reports whether the database connection can run without TLS.
func (*Config) OTelEnabled ¶
OTelEnabled reports whether an OpenTelemetry exporter is configured.
func (*Config) TLSEnabled ¶
TLSEnabled reports whether the HTTP transport should be served over TLS.
Click to show internal directories.
Click to hide internal directories.