config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandEnv

func ExpandEnv(input string) string

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

func ExpandEnvBytes(input []byte) []byte

ExpandEnvBytes is a convenience wrapper around ExpandEnv for byte slices Useful for processing file contents before YAML/JSON unmarshaling

func ExtractEnvVars

func ExtractEnvVars(input string) []string

ExtractEnvVars extracts all environment variable names referenced in the input This is useful for validation or documentation purposes

func ReplaceEnvVarsForDisplay

func ReplaceEnvVarsForDisplay(input string) string

ReplaceEnvVarsForDisplay replaces environment variable values with masked strings for safe display in logs or error messages Example: "password: ${DB_PASSWORD}" -> "password: ***"

func ValidateEnvVars

func ValidateEnvVars(input string) []string

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.

Jump to

Keyboard shortcuts

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