environment

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: Apache-2.0 Imports: 11 Imported by: 1

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(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 EnvFilesProviders

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

func NewEnvFilesProvider

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

func (*EnvFilesProviders) Get

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

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

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

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

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

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

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

Jump to

Keyboard shortcuts

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