Documentation
¶
Overview ¶
Package vars provides shared regex patterns and utilities for variable expansion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ChainVar = regexp.MustCompile(`\$\{[^}]*\.[^}]+\}`)
ChainVar matches ${step.field} patterns (contains a dot).
var EnvOnly = regexp.MustCompile(`\$\{([A-Za-z_][A-Za-z0-9_]*)\}`)
EnvOnly matches ${VAR} patterns without dots (environment variables only). Group 1: contents inside ${...}
var Expansion = regexp.MustCompile(`\$\{([^}]+)\}`)
Expansion matches ${VAR} patterns only (strict form required). This prevents ambiguity with dollar signs in bcrypt hashes, dollar amounts, etc. Variables can contain dots for chain references: ${step.field} Group 1: contents inside ${...}
Functions ¶
func EnvResolver ¶ added in v0.5.0
EnvResolver resolves environment variables only.
func ExpandAll ¶ added in v0.5.0
ExpandAll recursively expands environment variables in all string fields and map values of a struct using the provided resolver. This eliminates the need for manual field-by-field expansion when adding new config fields.
func ExpandString ¶
ExpandString replaces all ${VAR} occurrences in input using the resolver.
func HasChainVars ¶
HasChainVars returns true if the string contains chain variable references (${step.field}).
func HasEnvVars ¶
HasEnvVars returns true if the string contains environment variable references ($VAR or ${VAR}).
func MockResolver ¶ added in v0.5.0
MockResolver provides placeholder values for variable interpolation in LSP validation. This allows the compiler to validate the config structure even without real env vars.