Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #228 from jonboulle/env
Browse files Browse the repository at this point in the history
SPEC: specify only minimum set of environment vars
  • Loading branch information
jonboulle committed Mar 10, 2015
2 parents 5584b15 + 0bd25ac commit 148303f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
6 changes: 5 additions & 1 deletion SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,18 @@ Note that logging mechanisms other than stdout and stderr are not required by th

#### Execution Environment

* **Working directory** defaults to the root of the application image, overridden with "workingDirectory"
The following environment variables MUST be set for each application's main process and any lifecycle processes:
* **PATH** `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
* **USER, LOGNAME** username of the user executing this app
* **HOME** home directory of the user
* **SHELL** login shell of the user
* **AC_APP_NAME** name of the application, as defined in the image manifest
* **AC_METADATA_URL** URL where the metadata service for this container can be found

An executor MAY set additional environment variables for the application processes.

Additionally, processes must have their **working directory** set to the value of the application's **workingDirectory** option, if specified, or the root of the application image by default.

### Isolators

Isolators enforce resource constraints rather than namespacing.
Expand Down
14 changes: 2 additions & 12 deletions ace/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ func ValidateWorkingDirectory(wwd string) (r results) {
return
}

// ValidateEnvironment ensures that the given environment exactly maps the
// environment in which this process is running
// ValidateEnvironment ensures that the given environment contains the
// necessary/expected environment variables.
func ValidateEnvironment(wenv map[string]string) (r results) {
for wkey, wval := range wenv {
gval := os.Getenv(wkey)
Expand All @@ -187,16 +187,6 @@ func ValidateEnvironment(wenv map[string]string) (r results) {
r = append(r, err)
}
}
for _, s := range os.Environ() {
parts := strings.SplitN(s, "=", 2)
k := parts[0]
_, ok := wenv[k]
switch {
case k == appNameEnv, k == "PATH", k == "TERM", k == "AC_METADATA_URL":
case !ok:
r = append(r, fmt.Errorf("unexpected environment variable %q set", k))
}
}
return
}

Expand Down

0 comments on commit 148303f

Please sign in to comment.