envvar

package
v5.78.4 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package envvar provides utilities for working with environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(value string) string

Expand replaces ${VAR_NAME}, ${VAR_NAME:-default}, and ${VAR_NAME:=default} placeholders with their environment variable values. If a referenced environment variable is not set:

  • With default syntax ${VAR:-default} or ${VAR:=default}: uses the default value
  • Without default ${VAR}: uses empty string and logs a warning

func ExpandBytes

func ExpandBytes(data []byte) []byte

ExpandBytes expands environment variables in byte slice content. This is a convenience wrapper for expanding YAML or other file content.

func ExpandBytesWithLookup added in v5.78.2

func ExpandBytesWithLookup(data []byte, lookup func(string) (string, bool)) []byte

ExpandBytesWithLookup expands placeholders in byte slice content using the provided lookup function.

func ExpandWithLookup added in v5.78.2

func ExpandWithLookup(value string, lookup func(string) (string, bool)) string

ExpandWithLookup expands placeholders using the provided lookup function. The lookup function is checked before default handling. If lookup is nil, it defaults to os.LookupEnv.

Types

This section is empty.

Jump to

Keyboard shortcuts

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