config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config provides unified configuration loading for epithet. It supports YAML, JSON, and CUE file formats using CUE as the underlying parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAndUnifyPaths

func LoadAndUnifyPaths(patterns []string) (cue.Value, error)

LoadAndUnifyPaths loads multiple config files and unifies them into a single CUE value. Supports glob patterns and mixed file types (.cue, .yaml, .yml, .json). Missing files are silently skipped. Returns error if files have conflicting values.

func LoadFromFile

func LoadFromFile[T any](path string) (*T, error)

LoadFromFile loads configuration from a file or directory into the specified type.

For .cue files: Uses CUE's load.Instances to support CUE packages with imports and modules. For .yaml/.yml/.json files: Uses direct parsing for standalone data files. For directories: Loads all .cue files as a package (supports imports between files).

Examples:

cfg, err := LoadFromFile[PolicyRulesConfig]("policy.yaml")
cfg, err := LoadFromFile[PolicyRulesConfig]("./config")  // loads .cue directory

func LoadValue

func LoadValue(path string) (cue.Value, error)

LoadValue loads configuration from a file and returns a CUE value. This allows dynamic path-based lookups without requiring Go struct definitions.

For .cue files: Uses CUE's load.Instances to support CUE packages with imports and modules. For .yaml/.yml/.json files: Uses direct parsing for standalone data files. For directories: Loads all .cue files as a package (supports imports between files).

Types

This section is empty.

Jump to

Keyboard shortcuts

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