Documentation
¶
Overview ¶
Package config defines pdbq's configuration model and its loading rules: YAML file < environment (PDBQ_*) < command-line flags.
Every field carries a `koanf` tag (its YAML/env path) and a `doc` tag; the annotated reference YAML (`pdbq config example`) is generated from these tags so documentation can never drift from the structs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExampleYAML ¶
func ExampleYAML() string
ExampleYAML renders the fully-commented reference configuration from the Config struct tags and defaults, so the reference can never drift from the real config surface.
Types ¶
type Auth ¶
type Auth struct {
Mode string `koanf:"mode" doc:"Claim source: 'jwt', 'headers' (behind a trusted gateway), or 'none'."`
JWTSecret string `koanf:"jwt_secret" doc:"HMAC secret for HS256/384/512 verification (jwt mode; ignored when jwks_url is set)."`
JWKSURL string `` /* 134-byte string literal not displayed */
JWKSCacheTTL time.Duration `koanf:"jwks_cache_ttl" doc:"How long fetched JWKS keys are cached; an unknown kid triggers an early refresh (key rotation)."`
JWTIssuer string `koanf:"jwt_issuer" doc:"Expected iss claim; empty skips the check."`
JWTAudience string `koanf:"jwt_audience" doc:"Expected aud claim; empty skips the check."`
HeaderPrefix string `koanf:"header_prefix" doc:"Header prefix mapped to claims in headers mode, e.g. X-Pdbq-Claim-."`
TrustedProxies []string `` /* 223-byte string literal not displayed */
JWTType string `` /* 320-byte string literal not displayed */
}
type Config ¶
type Config struct {
Database Database `koanf:"database"`
Server Server `koanf:"server"`
Schema Schema `koanf:"schema"`
Filters Filters `koanf:"filters"`
RLS RLS `koanf:"rls"`
TX TX `koanf:"transactions"`
Watch Watch `koanf:"watch"`
Errors Errors `koanf:"errors"`
Plugins Plugins `koanf:"plugins"`
Log Log `koanf:"log"`
}
func Load ¶
Load builds the effective config: defaults, then optional YAML file, then PDBQ_* env vars, then flags (highest precedence).
func (*Config) DisabledPlugins ¶
DisabledPlugins returns the disabled-plugin set for registry filtering.
type Database ¶
type Database struct {
URL string `` /* 131-byte string literal not displayed */
MaxConns int32 `koanf:"max_conns" doc:"Maximum pooled connections."`
ConnectTimeout time.Duration `koanf:"connect_timeout" doc:"Timeout for establishing a connection."`
StatementTimeout time.Duration `koanf:"statement_timeout" doc:"Per-statement timeout applied to every request (0 disables)."`
}
type RLS ¶
type RLS struct {
Enabled bool `` /* 180-byte string literal not displayed */
DefaultRole string `koanf:"default_role" doc:"Role assumed for authenticated requests without a role claim."`
AnonymousRole string `koanf:"anonymous_role" doc:"Role assumed for unauthenticated requests."`
RoleClaim string `koanf:"role_claim" doc:"JWT claim (or header name in header mode) carrying the database role."`
AllowedRoles []string `` /* 178-byte string literal not displayed */
ClaimsPrefix string `koanf:"claims_prefix" doc:"set_config namespace for request claims, e.g. pdbq.claims."`
Auth Auth `koanf:"auth"`
}
type Schema ¶
type Schema struct {
Schemas []string `koanf:"schemas" doc:"PostgreSQL schemas to expose."`
CachePath string `koanf:"cache_path" doc:"Boot from this schema cache file instead of introspecting (see pdbq schema dump)."`
Functions bool `koanf:"functions" doc:"Expose PostgreSQL functions as custom queries/mutations."`
}
type Server ¶
type Server struct {
Addr string `koanf:"addr" doc:"Listen address for the HTTP server."`
GraphiQL bool `koanf:"graphiql" doc:"Serve the GraphiQL playground at / (off by default; enable for development)."`
ExposeSchema bool `` /* 160-byte string literal not displayed */
RequestTimeout time.Duration `koanf:"request_timeout" doc:"Overall HTTP request timeout."`
MaxBodyBytes int64 `koanf:"max_body_bytes" doc:"Maximum accepted request body size in bytes."`
MaxDepth int `koanf:"max_depth" doc:"Maximum GraphQL selection depth per operation."`
MaxCost int `koanf:"max_cost" doc:"Maximum estimated cost (selected fields x list multipliers) per operation."`
MaxPageSize int `` /* 136-byte string literal not displayed */
CORSOrigins []string `` /* 129-byte string literal not displayed */
Compression bool `koanf:"compression" doc:"Gzip responses for clients that send Accept-Encoding: gzip (off by default)."`
APQ bool `` /* 179-byte string literal not displayed */
PersistedQueriesPath string `` /* 142-byte string literal not displayed */
PersistedOnly bool `` /* 159-byte string literal not displayed */
ReadOnly bool `` /* 195-byte string literal not displayed */
DisableIntrospection bool `` /* 173-byte string literal not displayed */
}
type TX ¶
type TX struct {
Mutations bool `koanf:"mutations" doc:"Wrap every mutation in a transaction."`
PerRequest bool `koanf:"per_request" doc:"Use one transaction for the whole request instead of one per operation."`
Isolation string `koanf:"isolation" doc:"Transaction isolation level: read_committed, repeatable_read, serializable."`
MaxRetries int `` /* 233-byte string literal not displayed */
}