env

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPath defines default value for PATH environment variable.
	DefaultPath = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
	// SingularityPrefix defines the environment variable prefix SINGULARITY_.
	SingularityPrefix = "SINGULARITY_"
	// SingularityEnvPrefix defines the environment variable prefix SINGULARITYENV_.
	SingularityEnvPrefix = "SINGULARITYENV_"
)

Variables

View Source
var AlwaysOmitKeys = map[string]bool{
	"HOME":                false,
	"PATH":                false,
	"SINGULARITY_SHELL":   false,
	"SINGULARITY_APPNAME": false,
	"LD_LIBRARY_PATH":     true,
}

AlwaysOmitKeys lists environment variables that are never passed from the host into the container, with a boolean to indicate whether the key can be overridden by a user-specificed SINGULARITYENV_ / --env / --env-file value.

View Source
var AlwaysPassKeys = map[string]struct{}{
	"TERM":        {},
	"http_proxy":  {},
	"HTTP_PROXY":  {},
	"https_proxy": {},
	"HTTPS_PROXY": {},
	"no_proxy":    {},
	"NO_PROXY":    {},
	"all_proxy":   {},
	"ALL_PROXY":   {},
	"ftp_proxy":   {},
	"FTP_PROXY":   {},
}

AlwaysPassKeys lists environment variables that are always passed from the host into the container.

Functions

func AddHostEnv

func AddHostEnv(key string, cleanEnv bool) bool

AddHostEnv processes given key and returns if the environment variable should be added to the container or not.

func FileMap

func FileMap(ctx context.Context, f string, args []string, hostEnv []string) (map[string]string, error)

FileMap returns a map of KEY=VAL env vars from an environment file f. The env file is shell evaluated using mvdan/sh with arguments and environment set from args and hostEnv.

func HostEnvMap

func HostEnvMap(hostEnvs []string, cleanEnv bool) map[string]string

HostEnvMap returns a map of host env vars to pass into the container.

func MergeMap

func MergeMap(a map[string]string, b map[string]string) map[string]string

MergeMap merges two maps of environment variables, with values in b replacing values also set in a.

func SetContainerEnv

func SetContainerEnv(g *generate.Generator, hostEnvs []string, cleanEnv bool, homeDest string) map[string]string

SetContainerEnv cleans environment variables before running the container.

func SetFromList

func SetFromList(environ []string) error

SetFromList sets environment variables from environ argument list.

func SingularityEnvMap

func SingularityEnvMap(hostEnv []string) map[string]string

SingularityEnvMap returns a map of SINGULARITYENV_ prefixed env vars to their values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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