File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -142,8 +142,24 @@ specified more than once and will append to the configuration. However, there
142
142
can only be one ` command ` ; the last one will take priority.
143
143
144
144
You can also assign lambdas to environment variables. The lambda function will
145
- be invoked by Centurion with ` server_hostname ` as its only argument. This is
146
- useful to assign a sticky identity for each of the containers in the deploy.
145
+ be invoked by Centurion during deploy time with ` server_hostname ` as its only
146
+ argument. The ` server_hostname ` yielded will be the same string as was
147
+ specified in the ` host ` argument for the server currently being deployed to.
148
+
149
+ This is useful to assign a sticky identity for each of the containers
150
+ in the deploy. For example, a hash mapping hostname to another string which is
151
+ different on each host.
152
+ ``` ruby
153
+ desc ' Host-specific env vars'
154
+ task :production => :common do
155
+ env_vars MEMBER_ID: lambda do |hostname |
156
+ {
157
+ ' web-server-1.company.net' => ' machine1'
158
+ ' web-server-2.company.net' => ' machine2'
159
+ }[hostname]
160
+ end
161
+ end
162
+ ```
147
163
148
164
You can cause your container to be started with a specific DNS server
149
165
IP address (the equivalent of ` docker run --dns 172.17.42.1 ... ` ) like this:
You can’t perform that action at this time.
0 commit comments