Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 4 Imported by: 0

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 = confx.Auth

The shared sections (koanf paths and doc strings) live in pdbcore/confx; Server and TX (with per_request) are pdbq's own.

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 DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the documented defaults.

func Load

func Load(path string, flags *flag.FlagSet) (Config, error)

Load builds the effective config: defaults, then optional YAML file, then PDBQ_* env vars, then flags (highest precedence). Pass only the flags the user set (confx.ChangedFlags) so unset flags do not shadow YAML/env.

func (*Config) DisabledPlugins

func (c *Config) DisabledPlugins() map[string]bool

DisabledPlugins returns the disabled-plugin set for registry filtering.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks cross-field invariants.

type Database

type Database = confx.Database

The shared sections (koanf paths and doc strings) live in pdbcore/confx; Server and TX (with per_request) are pdbq's own.

type Errors

type Errors = confx.Errors

The shared sections (koanf paths and doc strings) live in pdbcore/confx; Server and TX (with per_request) are pdbq's own.

type Filters

type Filters = confx.Filters

The shared sections (koanf paths and doc strings) live in pdbcore/confx; Server and TX (with per_request) are pdbq's own.

type Log

type Log = confx.Log

The shared sections (koanf paths and doc strings) live in pdbcore/confx; Server and TX (with per_request) are pdbq's own.

type Plugins

type Plugins = confx.Plugins

The shared sections (koanf paths and doc strings) live in pdbcore/confx; Server and TX (with per_request) are pdbq's own.

type RLS

type RLS = confx.RLS

The shared sections (koanf paths and doc strings) live in pdbcore/confx; Server and TX (with per_request) are pdbq's own.

type Schema

type Schema = confx.Schema

The shared sections (koanf paths and doc strings) live in pdbcore/confx; Server and TX (with per_request) are pdbq's own.

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           `` /* 140-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 */
}

type Watch

type Watch = confx.Watch

The shared sections (koanf paths and doc strings) live in pdbcore/confx; Server and TX (with per_request) are pdbq's own.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL