{"modulePath":"github.com/windsorcli/cli","version":"v0.10.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package config\n\n## Constants\n\n```go\nconst AllRegistriesKey = \"*\"\n```\nAllRegistriesKey is the registries key for each registry host with no entry.\n\n```go\nconst SensitiveRedactionMarker = \"\u003csensitive\u003e\"\n```\nSensitiveRedactionMarker is the placeholder shown in place of a sensitive value in display output, so operators see that a field exists and is sensitive without its value being printed.\n\n## Variables\n\n```go\nvar DefaultConfig = cliconfig.Context{\n\tPlatform: \"none\",\n}\n```\nDefaultConfig is the base configuration for non-dev contexts (platform \"none\").\n\n```go\nvar DefaultConfig_Dev = cliconfig.Context{}\n```\nDefaultConfig\\_Dev provides defaults for all dev contexts (docker-desktop, colima, incus).\n\n## Functions\n\n```go\nfunc DefaultTerraformBackendTypeForPlatform(platform string) string\n```\nDefaultTerraformBackendTypeForPlatform returns the canonical terraform state backend for a platform, or \"\" when the platform has no default backend (the caller falls back to \"local\"). Kept in sync with the platform description in configuration.yaml.\n\n```go\nfunc FormatValidationErrors(errs []string) string\n```\nFormatValidationErrors renders a Validate result's Errors as an indented list, one violation per line, instead of Go's flat space-joined %v slice format, so a multi-error result reads as a scannable list rather than a run-on string.\n\n```go\nfunc MarshalValues(values map[string]any) ([]byte, error)\n```\nMarshalValues encodes context values as YAML with the keys in header order at every level. The other keys follow the header keys in alphabetical order.\n\n```go\nfunc RedactSensitiveValues(values map[string]any, sensitivePaths []string) map[string]any\n```\nRedactSensitiveValues replaces, in place, every existing value at a sensitive path with SensitiveRedactionMarker so display surfaces (e.g. windsor show values) never print secret material while still revealing that the field is set. A \"\\*\" path segment matches any single key. Absent paths are left untouched — redaction never fabricates keys. The same map is returned for convenience.\n\n```go\nfunc RenderValuesWithDescriptions(values map[string]any, schema map[string]any) string\n```\nRenderValuesWithDescriptions renders context values as YAML annotated with schema descriptions. It walks the union of schema properties and effective values so that every configurable field appears in the output. Set keys render as normal YAML with description comments; unset schema-defined keys render as commented-out reference lines. Top-level keys are separated by blank lines. Keys come in header order. When schema is nil, values are rendered as plain YAML without comments.\n\n```go\nfunc SensitiveValues(values map[string]any, sensitivePaths []string) []string\n```\nSensitiveValues returns the scalar values that values holds at each sensitive path, as strings. A \"\\*\" path segment matches any single key. A map or list at a sensitive path gives each scalar inside it. Absent paths and nil values give nothing.\n\n## Types\n\n```go\ntype ConfigHandler interface {\n\tLoadConfig() error\n\tLoadConfigForContext(contextName string) error\n\tLoadConfigString(content string) error\n\tGetString(key string, defaultValue ...string) string\n\tGetTerraformBackendType() string\n\tGetInt(key string, defaultValue ...int) int\n\tGetBool(key string, defaultValue ...bool) bool\n\tGetStringSlice(key string, defaultValue ...[]string) []string\n\tGetStringMap(key string, defaultValue ...map[string]string) map[string]string\n\tSet(key string, value any) error\n\tGet(key string) any\n\tSaveConfig(overwrite ...bool) error\n\tSaveWorkstationState() error\n\tSetDefault(context cliconfig.Context) error\n\tGetHeader() *cliconfig.Context\n\tGetContext() string\n\tWithContext(name string) ConfigHandler\n\tIsDevMode(contextName string) bool\n\tSetContext(context string) error\n\tGetConfigRoot() (string, error)\n\tGetWindsorScratchPath() (string, error)\n\tGetBasePath() (string, error)\n\tClean() error\n\tIsLoaded() bool\n\tGenerateContextID() error\n\tIsNewContext() (bool, error)\n\tLoadSchema(schemaPath string) error\n\tLoadSchemaFromBytes(schemaContent []byte) error\n\tGetSchema() map[string]any\n\tGetContextValues() (map[string]any, error)\n\tGetSetValues() map[string]any\n\tCheckRegistriesKeys() (bool, error)\n\tSetApplySchemaDefaults(enabled bool)\n\tGetSensitivePaths() []string\n\tIsSensitivePath(path string) bool\n\tValidateContextValues() error\n}\n```\nConfigHandler loads, saves, and reads the configuration of the current context.\n\n```go\nfunc NewConfigHandler(shell shell.Shell) ConfigHandler\n```\nNewConfigHandler creates a new ConfigHandler instance with default context configuration.\n\n```go\ntype Mirror struct {\n\tLocation string\n\tInsecure bool\n}\n```\nMirror is the mirror of one upstream registry host. Location is the host, the optional port, and the optional path of the endpoint, with no scheme. Insecure is true when the endpoint uses http.\n\n```go\ntype Mirrors map[string]Mirror\n```\nMirrors holds the mirror of each upstream registry host, keyed by host or by AllRegistriesKey. An entry with an empty Location turns off the mirror for its host.\n\n```go\nfunc NewMirrors(registries map[string]cliconfig.Registry) (Mirrors, error)\n```\nNewMirrors returns the mirror of each upstream host in registries. The upstream host is the host of the entry's local value, or its key. An entry with no endpoint gives its host an empty mirror, so the key \\* does not apply to that host. It returns an error when two entries give different mirrors to one upstream host.\n\n```go\nfunc (m Mirrors) For(host string) (Mirror, bool)\n```\nFor returns the mirror of host. A host with no entry uses the entry of the key \\*. It returns false when host has no mirror, or when the mirror is on host itself.\n\n```go\nfunc (m Mirrors) OCIURL(url string) (string, bool)\n```\nOCIURL returns the oci:// URL of the mirror of url, and true when the mirror uses http. The mirror URL keeps the path and the tag of url after the mirror location. It returns url unchanged when url is not an oci:// URL or its host has no mirror.\n\n```go\ntype MockConfigHandler struct {\n\tLoadConfigFunc              func() error\n\tLoadConfigForContextFunc    func(contextName string) error\n\tLoadConfigStringFunc        func(content string) error\n\tIsLoadedFunc                func() bool\n\tGetStringFunc               func(key string, defaultValue ...string) string\n\tGetTerraformBackendTypeFunc func() string\n\tGetIntFunc                  func(key string, defaultValue ...int) int\n\tGetBoolFunc                 func(key string, defaultValue ...bool) bool\n\tGetStringSliceFunc          func(key string, defaultValue ...[]string) []string\n\tGetStringMapFunc            func(key string, defaultValue ...map[string]string) map[string]string\n\tSetFunc                     func(key string, value any) error\n\tSaveConfigFunc              func(overwrite ...bool) error\n\tSaveWorkstationStateFunc    func() error\n\tGetFunc                     func(key string) any\n\tSetDefaultFunc              func(context cliconfig.Context) error\n\tGetHeaderFunc               func() *cliconfig.Context\n\tGetContextFunc              func() string\n\tIsDevModeFunc               func(contextName string) bool\n\tSetContextFunc              func(context string) error\n\tGetConfigRootFunc           func() (string, error)\n\tGetWindsorScratchPathFunc   func() (string, error)\n\tGetBasePathFunc             func() (string, error)\n\tCleanFunc                   func() error\n\tGenerateContextIDFunc       func() error\n\tIsNewContextFunc            func() (bool, error)\n\tLoadSchemaFunc              func(schemaPath string) error\n\tLoadSchemaFromBytesFunc     func(schemaContent []byte) error\n\tGetSchemaFunc               func() map[string]any\n\tGetContextValuesFunc        func() (map[string]any, error)\n\tGetSetValuesFunc            func() map[string]any\n\tCheckRegistriesKeysFunc     func() (bool, error)\n\tSetApplySchemaDefaultsFunc  func(enabled bool)\n\tGetSensitivePathsFunc       func() []string\n\tIsSensitivePathFunc         func(path string) bool\n\tValidateContextValuesFunc   func() error\n\t// contains filtered or unexported fields\n}\n```\nMockConfigHandler is a mock implementation of the ConfigHandler interface\n\n```go\nfunc NewMockConfigHandler() *MockConfigHandler\n```\nNewMockConfigHandler is a constructor for MockConfigHandler\n\n```go\nfunc (m *MockConfigHandler) CheckRegistriesKeys() (bool, error)\n```\nCheckRegistriesKeys calls the mock CheckRegistriesKeysFunc if set, otherwise returns false and no error.\n\n```go\nfunc (m *MockConfigHandler) Clean() error\n```\nClean calls the mock CleanFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) GenerateContextID() error\n```\nGenerateContextID calls the mock GenerateContextIDFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) Get(key string) any\n```\nGet calls the mock GetFunc if set, otherwise returns a reasonable default value\n\n```go\nfunc (m *MockConfigHandler) GetBasePath() (string, error)\n```\nGetBasePath calls the mock GetBasePathFunc if set, otherwise returns an empty path\n\n```go\nfunc (m *MockConfigHandler) GetBool(key string, defaultValue ...bool) bool\n```\nGetBool calls the mock GetBoolFunc if set, otherwise returns a reasonable default bool\n\n```go\nfunc (m *MockConfigHandler) GetConfigRoot() (string, error)\n```\nGetConfigRoot calls the mock GetConfigRootFunc if set, otherwise returns a reasonable default string\n\n```go\nfunc (m *MockConfigHandler) GetContext() string\n```\nGetContext calls the mock GetContextFunc if set; WithContext override takes priority over both\n\n```go\nfunc (m *MockConfigHandler) GetContextValues() (map[string]any, error)\n```\nGetContextValues calls the mock GetContextValuesFunc if set, otherwise returns an error\n\n```go\nfunc (m *MockConfigHandler) GetHeader() *cliconfig.Context\n```\nGetHeader calls the mock GetHeaderFunc if set, otherwise returns an empty header\n\n```go\nfunc (m *MockConfigHandler) GetInt(key string, defaultValue ...int) int\n```\nGetInt calls the mock GetIntFunc if set, otherwise returns a reasonable default int\n\n```go\nfunc (m *MockConfigHandler) GetSchema() map[string]any\n```\nGetSchema calls the mock GetSchemaFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) GetSensitivePaths() []string\n```\nGetSensitivePaths calls the mock GetSensitivePathsFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) GetSetValues() map[string]any\n```\nGetSetValues calls the mock GetSetValuesFunc if set, otherwise returns nil.\n\n```go\nfunc (m *MockConfigHandler) GetString(key string, defaultValue ...string) string\n```\nGetString calls the mock GetStringFunc if set, otherwise returns a reasonable default string\n\n```go\nfunc (m *MockConfigHandler) GetStringMap(key string, defaultValue ...map[string]string) map[string]string\n```\nGetStringMap calls the mock GetStringMapFunc if set, otherwise returns a reasonable default map of strings\n\n```go\nfunc (m *MockConfigHandler) GetStringSlice(key string, defaultValue ...[]string) []string\n```\nGetStringSlice calls the mock GetStringSliceFunc if set, otherwise returns a reasonable default slice of strings\n\n```go\nfunc (m *MockConfigHandler) GetTerraformBackendType() string\n```\nGetTerraformBackendType calls the mock GetTerraformBackendTypeFunc if set, otherwise falls back to GetString(\"terraform.backend.type\", \"local\") so a test that only stubs GetStringFunc keeps working without also stubbing this method.\n\n```go\nfunc (m *MockConfigHandler) GetWindsorScratchPath() (string, error)\n```\nGetWindsorScratchPath calls the mock GetWindsorScratchPathFunc if set, otherwise returns a reasonable default string\n\n```go\nfunc (m *MockConfigHandler) IsDevMode(contextName string) bool\n```\nIsDevMode calls the mock IsDevModeFunc if set, otherwise returns default dev mode logic\n\n```go\nfunc (m *MockConfigHandler) IsLoaded() bool\n```\nIsLoaded calls the mock IsLoadedFunc if set, otherwise returns false\n\n```go\nfunc (m *MockConfigHandler) IsNewContext() (bool, error)\n```\nIsNewContext calls the mock IsNewContextFunc if set, otherwise returns false\n\n```go\nfunc (m *MockConfigHandler) IsSensitivePath(path string) bool\n```\nIsSensitivePath calls the mock IsSensitivePathFunc if set, otherwise returns false\n\n```go\nfunc (m *MockConfigHandler) LoadConfig() error\n```\nLoadConfig calls the mock LoadConfigFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) LoadConfigForContext(contextName string) error\n```\nLoadConfigForContext calls the mock LoadConfigForContextFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) LoadConfigString(content string) error\n```\nLoadConfigString calls the mock LoadConfigStringFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) LoadSchema(schemaPath string) error\n```\nLoadSchema calls the mock LoadSchemaFunc if set, otherwise returns an error\n\n```go\nfunc (m *MockConfigHandler) LoadSchemaFromBytes(schemaContent []byte) error\n```\nLoadSchemaFromBytes calls the mock LoadSchemaFromBytesFunc if set, otherwise returns an error\n\n```go\nfunc (m *MockConfigHandler) SaveConfig(overwrite ...bool) error\n```\nSaveConfig calls the SaveConfigFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) SaveWorkstationState() error\n```\nSaveWorkstationState calls the mock SaveWorkstationStateFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) Set(key string, value any) error\n```\nSet calls the mock SetFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) SetApplySchemaDefaults(enabled bool)\n```\nSetApplySchemaDefaults calls the mock SetApplySchemaDefaultsFunc if set, otherwise is a no-op\n\n```go\nfunc (m *MockConfigHandler) SetContext(context string) error\n```\nSetContext calls the mock SetContextFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) SetDefault(context cliconfig.Context) error\n```\nSetDefault calls the mock SetDefaultFunc if set, otherwise does nothing\n\n```go\nfunc (m *MockConfigHandler) ValidateContextValues() error\n```\nValidateContextValues calls the mock ValidateContextValuesFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockConfigHandler) WithContext(name string) ConfigHandler\n```\nWithContext returns a new MockConfigHandler with the given context override applied. The original mock is not modified, consistent with the immutable semantics of WithContext.\n\n```go\ntype SchemaValidationResult struct {\n\tValid    bool           `json:\"valid\"`\n\tErrors   []string       `json:\"errors,omitempty\"`\n\tDefaults map[string]any `json:\"defaults,omitempty\"`\n}\n```\nSchemaValidationResult carries the outcome of a Validate call. Defaults is populated by Validate for callers that want both validation and defaults in one pass; standalone defaults extraction uses GetSchemaDefaults instead.\n\n```go\ntype SchemaValidator struct {\n\tShims  *Shims\n\tSchema map[string]any\n\t// contains filtered or unexported fields\n}\n```\nSchemaValidator handles Windsor blueprint schema validation.\n\n```go\nfunc NewSchemaValidator(shell shell.Shell) *SchemaValidator\n```\nNewSchemaValidator creates a new schema validator instance.\n\n```go\nfunc (sv *SchemaValidator) ErrorsAlreadyReported(errs []string) bool\n```\nErrorsAlreadyReported reports whether errs is the same set of errors last recorded by MarkErrorsReported, regardless of order.\n\n```go\nfunc (sv *SchemaValidator) GetSchemaDefaults() (map[string]any, error)\n```\nGetSchemaDefaults returns the default values declared in the loaded schema as a single nested map. Callers (accessors.go, resolve.go) merge this under user values to fill in fields the operator omitted. Defaults extraction walks the raw merged schema without touching kaptinlin's compiled form — see extractDefaults for why.\n\n```go\nfunc (sv *SchemaValidator) GetSensitivePaths() []string\n```\nGetSensitivePaths returns the dotted config paths of every property marked \\`sensitive: true\\` in the loaded schema, sorted for stable output. A free-form map region (additionalProperties) contributes a \"\\*\" wildcard segment for its dynamic key. Returns nil when no schema is loaded. The result is computed once per loaded schema and cached (invalidated on LoadSchemaFromBytes), so repeated calls — e.g. IsSensitivePath over every key of a config map — do not re-walk the schema. The returned slice is shared; callers must not mutate it.\n\n```go\nfunc (sv *SchemaValidator) LoadSchema(schemaPath string) error\n```\nLoadSchema loads a schema fragment from a file on disk and merges it into the current in-memory schema. Subsequent Validate / GetSchemaDefaults calls operate on the union.\n\n```go\nfunc (sv *SchemaValidator) LoadSchemaFromBytes(schemaContent []byte) error\n```\nLoadSchemaFromBytes parses a YAML schema fragment and merges it into the current in-memory schema. The first fragment becomes the base; later fragments deep-merge over it with overlay properties winning on conflict (see schema\\_merge.go). Loading any new fragment invalidates the compiled schema cache; recompilation runs on the next Validate or GetSchemaDefaults call.\n\n```go\nfunc (sv *SchemaValidator) MarkErrorsReported(errs []string)\n```\nMarkErrorsReported records errs (a Validate result's Errors) as already surfaced to the operator, so a later ErrorsAlreadyReported call for the identical error set — e.g. ValidateContextValues revalidating the same invalid data already warned about by valuesSource.Load earlier in the same invocation — can recognize the duplicate and skip re-printing it.\n\n```go\nfunc (sv *SchemaValidator) Validate(values map[string]any) (*SchemaValidationResult, error)\n```\nValidate checks values against the loaded schema and returns the outcome plus extracted defaults. Errors are flattened from kaptinlin's hierarchical EvaluationResult into one deduplicated, prioritized \"\\\u003cinstance-path\u003e: \\\u003ckeyword\u003e: \\\u003cmessage\u003e\" line per leaf — see collectErrors — pass them to FormatValidationErrors for display, or ErrorsAlreadyReported to check whether a caller earlier in this invocation already surfaced the identical set.\n\n```go\ntype Shims struct {\n\tshims.Shims\n\tYamlUnmarshalStrict func(data []byte, v any) error\n\tEvalSymlinks        func(path string) (string, error)\n\tCryptoRandRead      func([]byte) (int, error)\n}\n```\nShims holds the shared system call primitives, the strict YAML decoder, and the random byte source.\n\n```go\nfunc NewShims() *Shims\n```\nNewShims returns a Shims with every field set to its standard library implementation.\n\n","path":"github.com/windsorcli/cli/pkg/runtime/config","name":"config","synopsis":"","isRedistributable":true}
