Documentation ¶
Index ¶
- Constants
- Variables
- func AddHostEnv(key string, cleanEnv bool) bool
- func FileMap(ctx context.Context, f string, args []string, hostEnv []string) (map[string]string, error)
- func HostEnvMap(hostEnvs []string, cleanEnv bool) map[string]string
- func MergeMap(a map[string]string, b map[string]string) map[string]string
- func SetContainerEnv(g *generate.Generator, hostEnvs []string, cleanEnv bool, homeDest string) map[string]string
- func SetFromList(environ []string) error
- func SingularityEnvMap(hostEnv []string) map[string]string
Constants ¶
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 ¶
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.
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 ¶
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 ¶
HostEnvMap returns a map of host env vars to pass into the container.
func MergeMap ¶
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 ¶
SetFromList sets environment variables from environ argument list.
func SingularityEnvMap ¶
SingularityEnvMap returns a map of SINGULARITYENV_ prefixed env vars to their values.
Types ¶
This section is empty.