Skip to content

Commit 8117356

Browse files
committedSep 7, 2018
Document R/O-variables
1 parent 28baf10 commit 8117356

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
 

‎README.md

+26
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,32 @@ In the following example we declare the variable called "RELEASE" to have the va
9595
Run "wget -O /usr/local/bin/app-${RELEASE} \
9696
https://example.com/dist/app-${RELEASE}"
9797

98+
It is possible to override the value of a particular variable via a command-line argument, for example:
99+
100+
$ deployr run --set "ENVIRONMENT=PRODUCTION" ...
101+
102+
If you do this any attempt to `Set` the variable inside the recipe itself will be silently ignored. (i.e. A variable which is set on the command-line will become essentially read-only.) This is useful if you have a recipe where the only real difference is the set of configuration files, and the destination host. For example you could write all your copies like so:
103+
104+
#
105+
# Lack of recursive copy is a pain here.
106+
# See:
107+
# https://github.com/skx/deployr/issues/6
108+
#
109+
CopyFile files/${ENVIRONMENT}/etc/apache2.conf /etc/apache2/conf
110+
CopyFile files/${ENVIRONMENT}/etc/redis.conf /etc/redis/redis.conf
111+
..
112+
113+
Then have a tree of files:
114+
115+
├── files
116+
├── development
117+
│ ├── apache2.conf
118+
│ └── redis.conf
119+
└── production
120+
├── apache2.conf
121+
└── redis.conf
122+
123+
98124

99125
### Predefined Variables
100126

0 commit comments

Comments
 (0)
Please sign in to comment.