environment

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DockerDesktopEmail    = "DOCKER_EMAIL"
	DockerDesktopUsername = "DOCKER_USERNAME"
	DockerDesktopTokenEnv = "DOCKER_TOKEN"
)

Variables

This section is empty.

Functions

func AbsolutePath

func AbsolutePath(parentDir, relOrAbsPath string) (string, error)

func AbsolutePaths

func AbsolutePaths(parentDir string, relOrAbsPaths []string) ([]string, error)

func Expand

func Expand(ctx context.Context, value string, env Provider) (string, error)

func ExpandAll added in v1.0.5

func ExpandAll(ctx context.Context, values []string, env Provider) ([]string, error)

func ToValues added in v1.0.5

func ToValues(envMap map[string]string) []string

Types

type DockerDesktopProvider added in v1.9.1

type DockerDesktopProvider struct{}

func NewDockerDesktopProvider added in v1.9.1

func NewDockerDesktopProvider() *DockerDesktopProvider

func (*DockerDesktopProvider) Get added in v1.9.1

func (p *DockerDesktopProvider) Get(ctx context.Context, name string) (string, bool)

type EnvFilesProvider added in v1.15.0

type EnvFilesProvider struct {
	// contains filtered or unexported fields
}

EnvFilesProvider provides access env files.

func NewEnvFilesProvider

func NewEnvFilesProvider(absEnvFiles []string) (*EnvFilesProvider, error)

func (*EnvFilesProvider) Get added in v1.15.0

func (p *EnvFilesProvider) Get(_ context.Context, name string) (string, bool)

type EnvListProvider added in v1.15.0

type EnvListProvider struct {
	// contains filtered or unexported fields
}

EnvListProvider provides access a list of environment variables.

func NewEnvListProvider added in v1.15.0

func NewEnvListProvider(env []string) *EnvListProvider

func (*EnvListProvider) Get added in v1.15.0

func (p *EnvListProvider) Get(_ context.Context, name string) (string, bool)

type ErrKeychainNotAvailable added in v1.0.4

type ErrKeychainNotAvailable struct{}

func (ErrKeychainNotAvailable) Error added in v1.0.4

type ErrPassNotAvailable added in v1.0.3

type ErrPassNotAvailable struct{}

func (ErrPassNotAvailable) Error added in v1.0.3

func (ErrPassNotAvailable) Error() string

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value string
}

func ReadEnvFile

func ReadEnvFile(absolutePath string) ([]KeyValuePair, error)

func ReadEnvFiles

func ReadEnvFiles(absolutePaths []string) ([]KeyValuePair, error)

type KeychainProvider added in v1.0.4

type KeychainProvider struct{}

KeychainProvider is a provider that retrieves secrets using the macOS keychain via the `security` command-line tool.

func NewKeychainProvider added in v1.0.4

func NewKeychainProvider() (*KeychainProvider, error)

NewKeychainProvider creates a new KeychainProvider instance. It verifies that the `security` command is available on the system.

func (*KeychainProvider) Get added in v1.0.4

func (p *KeychainProvider) Get(ctx context.Context, name string) (string, bool)

Get retrieves the value of a secret by its service name from the macOS keychain. It uses the `security find-generic-password -w -s <name>` command to fetch the password.

type MultiProvider

type MultiProvider struct {
	// contains filtered or unexported fields
}

func NewMultiProvider

func NewMultiProvider(providers ...Provider) *MultiProvider

func (*MultiProvider) Get

func (p *MultiProvider) Get(ctx context.Context, name string) (string, bool)

type OsEnvProvider

type OsEnvProvider struct{}

OsEnvProvider provides access to the operating system's environment variables.

func NewOsEnvProvider

func NewOsEnvProvider() *OsEnvProvider

func (*OsEnvProvider) Get

func (p *OsEnvProvider) Get(_ context.Context, name string) (string, bool)

type PassProvider added in v1.0.3

type PassProvider struct{}

PassProvider is a provider that retrieves secrets using the `pass` password manager.

func NewPassProvider added in v1.0.3

func NewPassProvider() (*PassProvider, error)

NewPassProvider creates a new PassProvider instance.

func (*PassProvider) Get added in v1.0.3

func (p *PassProvider) Get(ctx context.Context, name string) (string, bool)

Get retrieves the value of a secret by its name using the `pass` CLI. The name corresponds to the path in the `pass` store.

type Provider

type Provider interface {
	// Get retrieves the value of an environment variable by name.
	// Returns (value, true) if found (value may be empty).
	// Returns ("", false) if not found.
	Get(ctx context.Context, name string) (string, bool)
}

func NewDefaultProvider

func NewDefaultProvider() Provider

type RequiredEnvError added in v1.0.7

type RequiredEnvError struct {
	Missing []string
}

func (*RequiredEnvError) Error added in v1.0.7

func (e *RequiredEnvError) Error() string

type RunSecretsProvider added in v1.0.7

type RunSecretsProvider struct {
	// contains filtered or unexported fields
}

func NewRunSecretsProvider added in v1.0.7

func NewRunSecretsProvider() *RunSecretsProvider

func (*RunSecretsProvider) Get added in v1.0.7

func (p *RunSecretsProvider) Get(_ context.Context, name string) (string, bool)

Jump to

Keyboard shortcuts

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