config

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config provides configuration loading and validation for the toolkit CLI application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RepoPath     string `mapstructure:"repo-path"`
	KubeConfig   string `mapstructure:"kubeconfig"`
	EnvType      string `mapstructure:"env-type"`
	EnvRegion    string `mapstructure:"env-region"`
	EnvRealm     string `mapstructure:"env-realm"`
	Category     string `mapstructure:"category"`
	LogFile      string `mapstructure:"log-file"`
	Debug        bool   `mapstructure:"debug"`
	Filter       string `mapstructure:"filter"`
	MetadataFile string `mapstructure:"metadata-file"`
	// MutationEnvOverrideAllowed opts MCP mutation tools into per-call
	// env_type / env_region / env_realm overrides. Default false: tools
	// silently fall back to the startup env, even if the agent provides
	// override fields. The flip is meaningful: with the override
	// allowed, a prompt-injection attack that sets confirm=true also
	// controls which realm is targeted, so the operator's kubeconfig /
	// OCI credentials decide the maximum blast radius — not the
	// operator's startup-env choice.
	MutationEnvOverrideAllowed bool `mapstructure:"mutation-env-override-allowed"`
}

Config holds configuration for the toolkit CLI application.

func (*Config) Normalize added in v0.10.0

func (c *Config) Normalize() error

Normalize canonicalizes the user-supplied env values in place: short region codes expand to full OCI region identifiers ("phx" -> "us-phoenix-1") and "ppe" becomes "preprod". Case is folded, so "PHX" and "PPE" resolve too.

Empty values are left empty rather than resolved, so the required-setting errors in Validate and validateLoaderConfig still name the missing flag instead of reporting an unknown region code for a value the user never supplied.

Call this immediately after unmarshalling and before constructing a models.Environment. EnvRegion reaches the OCI SDK and OCID construction verbatim, so a short code that survives normalization produces a wrong endpoint and wrong OCIDs rather than a clean failure.

func (Config) Validate

func (c Config) Validate() error

Validate checks that all required fields in the Config are set and valid.

Jump to

Keyboard shortcuts

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