config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config loads context-guru's configuration and builds a pipeline from it. One strict YAML struct serves both hosts (design D9): the proxy loads a file; the AuthBridge plugin hands its config: subtree to LoadBytes; a k8s ConfigMap/CRD just renders the same YAML.

The pipeline: name-list controls order + enablement. Each component's own typed config lives under components:<name>; it's handed to the component's constructor verbatim, so adding a component makes it configurable with no change here. A preset expands to a default pipeline + component configs, which the explicit fields then override.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PresetPipeline

func PresetPipeline(name string) ([]string, bool)

PresetPipeline returns the default pipeline (ordered component names) for a named preset. It's the safe way to resolve a caller-supplied preset name (e.g. a /compact ?preset= query param) — a plain map lookup, no YAML parsing of untrusted input.

Types

type Config

type Config struct {
	Preset     string               `yaml:"preset"`
	Pipeline   []string             `yaml:"pipeline"`
	Components map[string]yaml.Node `yaml:"components"`
	Store      store.Options        `yaml:"store"`
}

Config is the whole configuration document.

func Load

func Load(path string) (*Config, error)

Load reads and parses a YAML config file (strict: unknown keys are rejected).

func LoadBytes

func LoadBytes(b []byte) (*Config, error)

LoadBytes parses a YAML config document (strict). Used by the AuthBridge plugin's Configure, which receives its subtree as bytes.

func (*Config) Build

Build constructs the ordered pipeline from the config, wiring each named component with its raw config block.

func (*Config) NewStore

func (c *Config) NewStore() store.Store

NewStore builds the configured state store: an in-memory TTL+LRU by default, or a no-op store when store.enabled is false (disables offload reversibility).

Jump to

Keyboard shortcuts

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