@@ -47,15 +47,15 @@ Global Flags:
47
47
```
48
48
49
49
## Interpolation
50
-
51
50
Given a template file with a variable reference:
52
51
53
52
``` yaml
54
53
# config.yml
55
54
key : ((variable_name))
56
55
` ` `
57
56
58
- Values can be provided from a separate variables yaml file (` --vars-file`) or from environment variables (`--vars-env`).
57
+ Values can be provided from a separate variables yaml file (` --vars-file`)
58
+ or from environment variables (`--vars-env`).
59
59
60
60
To load variables from a file use the `--vars-file` flag.
61
61
@@ -81,4 +81,52 @@ OM_VAR_variable_name=some_value om interpolate \
81
81
82
82
The interpolation support is inspired by similar features in BOSH. You can
83
83
[refer to the BOSH documentation](https://bosh.io/docs/cli-int/) for details on how interpolation
84
- is performed.
84
+ is performed.
85
+
86
+ One significant difference from similar features in BOSH
87
+ and Concourse `fly` is that `om` performs _dual-pass_ interpolation.
88
+ That is, the template is interpolated (including applying ops files) once,
89
+ and then the output of that interpolation is interpolated again,
90
+ using the same arguments (except for Ops Files,
91
+ which are not necessarily idempotent).
92
+
93
+ This allows the use of _mapping variables_,
94
+ variables that contain a value that is a variable in turn.
95
+ Mapping variables are useful for mapping
96
+ between programmatically-generated variable names
97
+ such as those created by `om config-template` and `om staged-director-config`,
98
+ and credentials that may be used in multiple places,
99
+ such as database passwords.
100
+
101
+ Such config might look something like this:
102
+
103
+ ```
104
+ cc:
105
+ database-password: ((cc_database_password))
106
+ uaa:
107
+ database-password: ((uaa_database_password))
108
+ ```
109
+
110
+ In such cases, a vars-file like this can encode the relationship:
111
+
112
+ ```
113
+ ---
114
+ cc_database_password: ((sql_password))
115
+ uaa_database_password: ((sql_password))
116
+ ```
117
+
118
+ Assuming the value of `sql_password` is available to the interpolation,
119
+ it will be present in the final output,
120
+ like so:
121
+
122
+ ```
123
+ cc:
124
+ database-password: actualsqlpasswordverysecure
125
+ uaa:
126
+ database-password: actualsqlpasswordverysecure
127
+ ```
128
+
129
+ This feature generally shouldn't interfere with interpolation
130
+ as it would normally work in BOSH.
131
+ If you encounter any situation where this difference is an unwelcome surprise,
132
+ please open an issue; we were unable to think of any.
0 commit comments