Documentation
¶
Overview ¶
Package casemap provides utilities for preserving original case of YAML map keys. Viper automatically lowercases all YAML map keys, which breaks case-sensitive configurations like environment variables (e.g., GITHUB_TOKEN becomes github_token). This package extracts original case from raw YAML before Viper processes it, allowing restoration of original key casing when needed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CaseMap ¶
CaseMap stores lowercase -> original case mappings for YAML keys. Use this to restore original case after Viper lowercases map keys.
func CollectEnvKeysRecursive ¶ added in v1.222.0
CollectEnvKeysRecursive walks the raw YAML and returns a CaseMap of lowercase->original for every key found under any `env:` mapping at any depth: the top-level `env:`, plus custom-command and step-level `env:` blocks. Viper lowercases map keys, but environment variable names are case-sensitive, so this lets nested env sections (e.g. commands[].steps[].env) be restored the same way the top-level `env:` already is. Command-level `env:` written as a list of {key, value} pairs is unaffected by Viper and is intentionally not collected here.
type CaseMaps ¶
type CaseMaps struct {
// contains filtered or unexported fields
}
CaseMaps holds all case mappings for different config paths.
func ExtractFromYAML ¶
ExtractFromYAML extracts case mappings from raw YAML for specified paths. Paths is a list of dot-separated paths, e.g., ["env", "auth.identities"].
func (*CaseMaps) ApplyCase ¶
ApplyCase returns a new map with keys converted to their original case. Keys not in the case map are returned unchanged.