environment

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

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(value string, env []string) string

Types

type EnvFilesProviders

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

func NewEnvFilesProvider

func NewEnvFilesProvider(absEnvFiles []string) *EnvFilesProviders

func (*EnvFilesProviders) Get

func (p *EnvFilesProviders) Get(ctx context.Context, name string) (string, error)

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 KeyValueProvider

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

KeyValueProvider provides access to a map of key-value pairs as environment variables usually configured with `env:` section in a configuration file.

func NewKeyValueProvider

func NewKeyValueProvider(env map[string]string) *KeyValueProvider

func (*KeyValueProvider) Get

func (p *KeyValueProvider) Get(ctx context.Context, name string) (string, error)

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, error)

type NoFailProvider

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

func NewNoFailProvider

func NewNoFailProvider(provider Provider) *NoFailProvider

func (*NoFailProvider) Get

func (p *NoFailProvider) Get(ctx context.Context, name string) (string, error)

type OnePasswordProvider

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

func NewOnePasswordProvider

func NewOnePasswordProvider() *OnePasswordProvider

func (*OnePasswordProvider) Get

func (p *OnePasswordProvider) Get(ctx context.Context, name string) (string, error)

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(ctx context.Context, name string) (string, error)

type Provider

type Provider interface {
	// Get retrieves the value of an environment variable by name.
	Get(ctx context.Context, name string) (string, error)
}

func NewDefaultProvider

func NewDefaultProvider() Provider

Jump to

Keyboard shortcuts

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