config

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config loads configuration from environment variables.

Index

Constants

View Source
const (
	GatewayDiscoveryModeHeader    = "header"
	GatewayDiscoveryModeSubdomain = "subdomain"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	AllowOrigins     []string
	AllowMethods     []string
	AllowHeaders     []string
	ExposeHeaders    []string
	AllowCredentials bool
	MaxAge           string
}

CORSConfig drives the CORSMiddleware applied by both admin and proxy. Lists are comma-separated in env. Use "*" in AllowOrigins to allow any.

type CacheConfig

type CacheConfig struct {
	LocalTTL time.Duration
}

CacheConfig drives the in-process TTL cache used by app-layer finders. RUN-291 (B.1) will add a parallel Redis-backed layer; the finder contract will not change.

type CatalogConfig

type CatalogConfig struct {
	ModelsDevBaseURL string
}

type Config

type Config struct {
	AppEnv           string
	Server           ServerConfig
	Database         DatabaseConfig
	Redis            RedisConfig
	Cache            CacheConfig
	SessionStore     SessionStoreConfig
	Kafka            KafkaConfig
	Telemetry        TelemetryConfig
	Metrics          MetricsConfig
	Playground       PlaygroundConfig
	Upstream         UpstreamConfig
	Provider         ProviderConfig
	Catalog          CatalogConfig
	CORS             CORSConfig
	Logger           LoggerConfig
	TrustGuard       TrustGuardConfig
	OpenAIModeration OpenAIModerationConfig
}

func LoadConfig

func LoadConfig() (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type DatabaseConfig

type DatabaseConfig struct {
	Host              string
	Port              int
	User              string
	Password          string // #nosec G117 -- config struct field, not a hardcoded credential
	Name              string
	SSLMode           string
	SSLRootCert       string
	MinConns          int32
	MaxConns          int32
	MaxConnLifetime   time.Duration
	MaxConnIdleTime   time.Duration
	HealthCheckPeriod time.Duration
	ConnectTimeout    time.Duration
}

type KafkaConfig

type KafkaConfig struct {
	Brokers []string
}

type LoggerConfig

type LoggerConfig struct {
	Level  slog.Level
	Format string
}

type MetricsConfig

type MetricsConfig struct {
	Enabled       bool
	QueueSize     int
	WorkerCount   int
	FlushInterval time.Duration
}

type OTLPConfig

type OTLPConfig struct {
	Endpoint    string
	Headers     map[string]string
	Protocol    string
	Timeout     time.Duration
	Insecure    bool
	Compression string
}

OTLPConfig holds process-level OTLP exporter defaults read from the standard OTEL_EXPORTER_OTLP_* environment variables. Per-gateway telemetry settings override any field present in the gateway configuration.

type OpenAIModerationConfig added in v0.2.4

type OpenAIModerationConfig struct {
	BaseURL string
	Timeout time.Duration
}

type PlaygroundConfig

type PlaygroundConfig struct {
	TraceStoreEnabled bool
	TraceStoreTTL     time.Duration
}

PlaygroundConfig drives the default Redis-backed trace store that lets the dashboard playground fetch the metrics Event for a request it just made. Only requests carrying the playground token are stored, with a short TTL.

type ProviderConfig

type ProviderConfig struct {
	RequestTimeout time.Duration
	MaxRetries     int
}

type RedisConfig

type RedisConfig struct {
	Host              string
	Port              int
	Password          string
	DB                int
	TLSEnabled        bool
	TLSInsecureVerify bool
}

type ServerConfig

type ServerConfig struct {
	AdminPort    int
	ProxyPort    int
	MCPPort      int
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	IdleTimeout  time.Duration
	// SecretKey signs and verifies admin-plane JWTs. Empty disables admin auth
	// token acceptance (every token is rejected).
	SecretKey            string
	GatewayBaseDomain    string
	MCPBaseDomain        string
	GatewayDiscoveryMode string
	STSIssuer            string
	STSSigningKey        string
	TrustXFCCFrom        []string
}

type SessionStoreConfig

type SessionStoreConfig struct {
	Enabled bool
	TTL     time.Duration
}

type TelemetryConfig

type TelemetryConfig struct {
	Enabled             bool
	KafkaTopic          string
	EnableRequestTraces bool
	EnablePluginTraces  bool
	OTLP                OTLPConfig
}

type TrustGuardConfig added in v0.2.4

type TrustGuardConfig struct {
	BaseURL      string
	Timeout      time.Duration
	ClientID     string
	ClientSecret string
}

type UpstreamConfig

type UpstreamConfig struct {
	Timeout          time.Duration
	ErrorPassthrough bool
}

Jump to

Keyboard shortcuts

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