Documentation
¶
Overview ¶
Package cueconfig provides CUE schema-based configuration validation, generation, and loading. The CUE schemas in cmd/schema/ are the single source of truth for configuration structure and default values. This package provides methods to work with configuration data without requiring explicit Go type definitions.
Index ¶
- type Config
- func (c *Config) Get(path string) any
- func (c *Config) GetBool(path string) bool
- func (c *Config) GetDuration(path string) time.Duration
- func (c *Config) GetInt(path string) int
- func (c *Config) GetMap(path string) map[string]any
- func (c *Config) GetString(path string) string
- func (c *Config) ToYAML() ([]byte, error)
- type SchemaValidator
- func (v *SchemaValidator) GenerateConfig(format string) ([]byte, error)
- func (v *SchemaValidator) GenerateConfigWithOverrides(format string, overrides map[string]any) ([]byte, error)
- func (v *SchemaValidator) GenerateScheduler(format string) ([]byte, error)
- func (v *SchemaValidator) LoadConfig(data []byte, format string) (*Config, error)
- func (v *SchemaValidator) LoadConfigWithEnvInterpolation(path string) (*Config, error)
- func (v *SchemaValidator) ValidateConfig(data []byte, format string) error
- func (v *SchemaValidator) ValidateScheduler(data []byte, format string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config represents the application configuration loaded from CUE. It wraps a map[string]any and provides typed accessor methods.
func (*Config) GetDuration ¶
GetDuration returns a time.Duration value at the given path
type SchemaValidator ¶
type SchemaValidator struct {
// contains filtered or unexported fields
}
SchemaValidator provides CUE schema validation and config loading
func NewValidator ¶
func NewValidator() *SchemaValidator
NewValidator creates a new schema validator
func (*SchemaValidator) GenerateConfig ¶
func (v *SchemaValidator) GenerateConfig(format string) ([]byte, error)
GenerateConfig generates a default configuration from the schema
func (*SchemaValidator) GenerateConfigWithOverrides ¶
func (v *SchemaValidator) GenerateConfigWithOverrides(format string, overrides map[string]any) ([]byte, error)
GenerateConfigWithOverrides generates configuration with optional overrides
func (*SchemaValidator) GenerateScheduler ¶
func (v *SchemaValidator) GenerateScheduler(format string) ([]byte, error)
GenerateScheduler generates a default scheduler configuration
func (*SchemaValidator) LoadConfig ¶
func (v *SchemaValidator) LoadConfig(data []byte, format string) (*Config, error)
LoadConfig loads configuration from YAML/JSON data, validates it against the schema, and returns a Config with defaults filled in from the CUE schema.
func (*SchemaValidator) LoadConfigWithEnvInterpolation ¶
func (v *SchemaValidator) LoadConfigWithEnvInterpolation(path string) (*Config, error)
LoadConfigWithEnvInterpolation loads config from file, expanding environment variables
func (*SchemaValidator) ValidateConfig ¶
func (v *SchemaValidator) ValidateConfig(data []byte, format string) error
ValidateConfig validates configuration data against the schema without loading
func (*SchemaValidator) ValidateScheduler ¶
func (v *SchemaValidator) ValidateScheduler(data []byte, format string) error
ValidateScheduler validates scheduler configuration data