Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandEnv ¶
ExpandEnv replaces environment variable references in the input string with their values.
Supported formats:
- ${VAR} - Replaces with the value of VAR, or empty string if not set
- ${VAR:-default} - Replaces with the value of VAR, or "default" if VAR is not set or empty
Example:
input := "host: ${DB_HOST:-localhost}, port: ${DB_PORT:-5432}"
output := ExpandEnv(input)
// If DB_HOST=mydb.com and DB_PORT is not set:
// output = "host: mydb.com, port: 5432"
func ExpandEnvBytes ¶
ExpandEnvBytes is a convenience wrapper around ExpandEnv for byte slices Useful for processing file contents before YAML/JSON unmarshaling
func ExtractEnvVars ¶
ExtractEnvVars extracts all environment variable names referenced in the input This is useful for validation or documentation purposes
func ReplaceEnvVarsForDisplay ¶
ReplaceEnvVarsForDisplay replaces environment variable values with masked strings for safe display in logs or error messages Example: "password: ${DB_PASSWORD}" -> "password: ***"
func ValidateEnvVars ¶
ValidateEnvVars checks if all required environment variables are set Returns a list of missing variable names Variables with default values (${VAR:-default}) are not considered required
Types ¶
This section is empty.