openshift/geard — pull request #217 by mfojtik (2014-06-25 09:52:51+00:00)
Title: Add support for environment variables in deployments

This will add support for defining environment variables that are passed into containers in deployment JSON. The main reason I made this is that when you are deploying eg. wordpress + mysql, then you have to set the MYSQL_PASS for the `mysql` image. Then on `mysql` run, this ENV var is passed into the mysql server.

Next use cases is Docker registry, you have to pass couple env vars to configure it properly. While you can do it now using the `--env-file` option, I think having this also in deployment would be useful.

```
{
"IdPrefix": "simple-",
"containers": [
{
"name": "test",
"count": 1,
"image": "openshift/busybox-http-app",
"env": {
"FOO": "bar",
"MYSQL_PASS": "secret"
}
}
]
}
```

`$ gear deploy simple.json`

Then:

```
$ cat /var/lib/containers/env/contents/si/simple-test-1
FOO=bar
MYSQL_PASS=secret
```