config

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package config provides infrastructure for loading profile configurations. This package handles YAML parsing, file I/O, variable substitution, and profile inheritance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProfileLoader

type ProfileLoader struct {
	// contains filtered or unexported fields
}

ProfileLoader handles loading profiles from YAML files with inheritance support.

Inheritance Resolution:

  • Profiles can specify parent profiles via the `extends` field
  • Parents are loaded recursively and merged left-to-right
  • Circular dependencies are detected and rejected
  • Relative paths are resolved from the extending profile's directory

Cycle Detection Note

This loader detects cycles in PROFILE INHERITANCE (extends field). This is different from Profile.CheckForCycles() which detects cycles in CONTROL DEPENDENCIES (depends_on field within a single profile).

This is different from Profile.CheckForCycles() which detects cycles in CONTROL DEPENDENCIES (depends_on field within a single profile).

func NewProfileLoader

func NewProfileLoader() *ProfileLoader

NewProfileLoader creates a new profile loader.

func (*ProfileLoader) LoadProfile

func (l *ProfileLoader) LoadProfile(path string) (*entities.Profile, error)

LoadProfile loads a profile and resolves all inheritance. This is the main entry point for profile loading.

func (*ProfileLoader) LoadProfileFromReader

func (l *ProfileLoader) LoadProfileFromReader(r io.Reader) (*entities.Profile, error)

LoadProfileFromReader loads a profile from an io.Reader. Note: This does NOT resolve inheritance, only parses YAML.

type RuntimeConfig

type RuntimeConfig struct {
	// Security
	SecurityLevel string

	// Evidence
	MaxEvidenceSizeBytes int

	// WASM
	WasmMemoryLimitMB int

	// Concurrency
	MaxConcurrentControls     int
	MaxConcurrentObservations int
}

RuntimeConfig aggregates all runtime configuration. This is a value object that flows through the system.

func FromSystemConfig

func FromSystemConfig(sys *system.Config) *RuntimeConfig

FromSystemConfig creates RuntimeConfig from system config.

func (*RuntimeConfig) ApplyDefaults

func (r *RuntimeConfig) ApplyDefaults()

ApplyDefaults applies defaults for zero values.

type VariableSubstitutor

type VariableSubstitutor struct {
	// contains filtered or unexported fields
}

VariableSubstitutor performs variable substitution in profiles.

func NewVariableSubstitutor

func NewVariableSubstitutor(resolver ports.SecretResolver) *VariableSubstitutor

NewVariableSubstitutor creates a new variable substitutor.

func (*VariableSubstitutor) Substitute

func (s *VariableSubstitutor) Substitute(profile *entities.Profile) error

Substitute performs simple variable substitution in a profile. It replaces {{ .vars.key }} patterns with values from the profile's vars map. Supports nested paths like {{ .vars.paths.config }}. Returns an error if a referenced variable is not found. Modifies the profile in place.

Jump to

Keyboard shortcuts

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