appconfig

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CoreConfigFileName is the fallback config file name.
	CoreConfigFileName = "config.yaml"
)

Variables

This section is empty.

Functions

func DecodeSettings

func DecodeSettings(settings map[string]any, out any) error

DecodeSettings decodes a settings map into a target struct using mapstructure tags.

func ExpandEnv

func ExpandEnv(input string) (string, error)

ExpandEnv expands $VAR and ${VAR} placeholders in the provided text.

func LoadConfigDocument

func LoadConfigDocument(runtimeOpts RuntimeLoadOptions, opts AppLoadOptions, out any) (string, error)

LoadConfigDocument loads and decodes a full app config document into out.

The selected file is single-source by priority:

  • default layout: <app>.yaml first, then config.yaml
  • app-dir layout (UseDotConfigAppDir): .config/<app>/config.yaml (or config-dir override targets)

Profile overrides (profiles.<name>) and app env overrides are applied before decode.

func LoadResolvedSettings

func LoadResolvedSettings(runtimeOpts RuntimeLoadOptions, opts AppLoadOptions) (map[string]any, string, error)

LoadResolvedSettings loads config defaults, merges the selected file, applies profile overlays and env overrides, and returns the final settings map.

func ValidateSettings

func ValidateSettings(settings map[string]any) error

ValidateSettings decodes and validates raw "runtime" settings.

Types

type AppLoadOptions

type AppLoadOptions struct {
	AppName      string
	DefaultsYAML []byte
	// UseDotConfigAppDir resolves config from app-specific .config layout:
	//   - <config-dir>/<app>/config.yaml, then <config-dir>/config.yaml
	//   - <working-dir>/.config/<app>/config.yaml
	UseDotConfigAppDir bool
}

AppLoadOptions configures app config loading on top of runtime config.

type RuntimeConfig

type RuntimeConfig struct {
	Providers  map[string]agentconfig.Config          `json:"providers,omitempty"   mapstructure:"providers"   validate:"required,gt=0"`
	MCPServers map[string]agentconfig.MCPServerConfig `json:"mcp_servers,omitempty" mapstructure:"mcp_servers" validate:"omitempty"`
}

RuntimeConfig contains runtime agent-factory settings.

Config shape:

runtime:
  providers: ...
  mcp_servers: ...

func (RuntimeConfig) Validate

func (c RuntimeConfig) Validate() error

Validate validates the runtime config.

type RuntimeLoadOptions

type RuntimeLoadOptions struct {
	WorkingDir string
	ConfigDir  string
	Profile    string
}

RuntimeLoadOptions configures runtime config loading.

Jump to

Keyboard shortcuts

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