FEATURE: Support `{{config}}` replacement to template name in `env`.
authorGuo Xiang Tan <tgx_world@hotmail.com>
Wed, 23 Jan 2019 03:56:29 +0000 (11:56 +0800)
committerGuo Xiang Tan <tgx_world@hotmail.com>
Wed, 23 Jan 2019 03:56:29 +0000 (11:56 +0800)
README.md
launcher

index e8762b2b174a6da2f8fad401ad01f510d6c01d22..4fd4a636f5be8f7e34bf979b317c7438afb60bfe 100644 (file)
--- a/README.md
+++ b/README.md
@@ -108,6 +108,20 @@ links:
 Links another container to the current container. This will add `--link postgres:postgres`
 to the options when running the container.
 
+#### environment variables:
+
+Setting environment variables to the current container.
+
+```
+# app.yml
+
+env:
+  DISCOURSE_DB_HOST: some-host
+  DISCOURSE_DB_NAME: {{config}}_discourse
+```
+
+The above will add `-e DISCOURSE_DB_HOST=some-host -e DISCOURSE_DB_NAME=app_discourse` to the options when running the container.
+
 #### labels:
 ```
 # app.yml
index 30245c8e716b2f811586bffcb43c1448f5cbce1d..d45b7133eb04a8751c98cf335a196a1c78cc411e 100755 (executable)
--- a/launcher
+++ b/launcher
@@ -353,7 +353,7 @@ RUBY
       if [ "$i" == "*ERROR." ]; then
         ok=0
       elif [ -n "$i" ]; then
-        env[${#env[@]}]=$i
+        env[${#env[@]}]=$(echo $i | sed s/{{config}}/${config}/g)
       fi
     done <<< "$raw"