config

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config handles loading and validating Creel server configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyConfig

type APIKeyConfig struct {
	Name      string `yaml:"name"`
	KeyHash   string `yaml:"key_hash"`
	Principal string `yaml:"principal"` // principal identity this key authenticates as
}

type AuthConfig

type AuthConfig struct {
	Providers      []OIDCProviderConfig `yaml:"providers"`
	PrincipalClaim string               `yaml:"principal_claim"`
	GroupsClaim    string               `yaml:"groups_claim"`
	APIKeys        []APIKeyConfig       `yaml:"api_keys"`
}

type CompactionConfig

type CompactionConfig struct {
	RetainCompactedChunks bool `yaml:"retain_compacted_chunks"`
}

type Config

type Config struct {
	Server        ServerConfig        `yaml:"server"`
	Auth          AuthConfig          `yaml:"auth"`
	Postgres      PostgresConfig      `yaml:"postgres"`
	VectorBackend VectorBackendConfig `yaml:"vector_backend"`
	Embedding     EmbeddingConfig     `yaml:"embedding"`
	Links         LinksConfig         `yaml:"links"`
	Compaction    CompactionConfig    `yaml:"compaction"`
	EncryptionKey string              `yaml:"encryption_key"`
}

Config is the top-level server configuration.

func Load

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

Load reads a YAML config file and applies environment variable overrides. Environment variables use the CREEL_ prefix with underscores replacing dots and nested keys joined by underscores. For example, CREEL_POSTGRES_HOST overrides postgres.host.

type EmbeddingConfig

type EmbeddingConfig struct {
	Provider string `yaml:"provider"`
	Model    string `yaml:"model"`
	APIKey   string `yaml:"api_key"`
}

type LinksConfig

type LinksConfig struct {
	AutoLinkOnIngest  bool    `yaml:"auto_link_on_ingest"`
	AutoLinkThreshold float64 `yaml:"auto_link_threshold"`
	MaxTraversalDepth int     `yaml:"max_traversal_depth"`
}

type OIDCProviderConfig

type OIDCProviderConfig struct {
	Issuer   string `yaml:"issuer"`
	Audience string `yaml:"audience"`
}

OIDCProviderConfig defines a trusted OIDC identity provider. Multiple providers can be configured to support different IdPs simultaneously.

type PostgresConfig added in v0.1.4

type PostgresConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Name     string `yaml:"name"`
	Schema   string `yaml:"schema"`
	SSLMode  string `yaml:"sslmode"`
}

PostgresConfig holds structured PostgreSQL connection parameters.

func PostgresConfigFromEnv added in v0.1.4

func PostgresConfigFromEnv() *PostgresConfig

PostgresConfigFromEnv builds a PostgresConfig from CREEL_POSTGRES_* environment variables. Returns nil if CREEL_POSTGRES_HOST is not set. Used by integration tests.

func (PostgresConfig) BaseURL added in v0.1.4

func (p PostgresConfig) BaseURL() string

BaseURL returns the connection string without search_path (for schema creation).

func (PostgresConfig) URL added in v0.1.4

func (p PostgresConfig) URL() string

URL returns the connection string with search_path set to the configured schema followed by public (so extensions installed in public are accessible).

type ServerConfig

type ServerConfig struct {
	GRPCPort    int `yaml:"grpc_port"`
	RESTPort    int `yaml:"rest_port"`
	MetricsPort int `yaml:"metrics_port"`
}

type VectorBackendConfig

type VectorBackendConfig struct {
	Type   string         `yaml:"type"`
	Config map[string]any `yaml:"config"`
}

Jump to

Keyboard shortcuts

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