Browse Source

docs(substitution): mention that all occurrences are replaced

Before it was unclear if all occurrences of a pattern were replaced
in a given target.

Change-Id: Ie02a54fef98a912b36b66891be8fed346ba5d9e0
changes/63/620963/5
Dustin Specker 6 months ago
parent
commit
815306ddf8
1 changed files with 26 additions and 1 deletions
  1. 26
    1
      doc/source/users/substitution.rst

+ 26
- 1
doc/source/users/substitution.rst View File

@@ -208,7 +208,9 @@ the hood. The ``dest.pattern`` has the following constraints:
208 208
 * The ``dest.pattern`` must be resolvable in the value of ``dest.path``.
209 209
 
210 210
 If the above constraints are met, then more precise substitution via a pattern
211
-can be carried out.
211
+can be carried out. If ``dest.path`` is a string or multiline string then all
212
+occurrences of ``dest.pattern`` found in ``dest.path`` will be replaced. To handle
213
+a more complex ``dest.path`` read `Recursive Replacement of Patterns`_.
212 214
 
213 215
 Example
214 216
 ^^^^^^^
@@ -226,6 +228,16 @@ Example
226 228
     storagePolicy: cleartext
227 229
   data: my-secret-password
228 230
   ---
231
+  # Another source document.
232
+  schema: deckhand/Passphrase/v1
233
+  metadata:
234
+    name: another-password
235
+    schema: metadata/Document/v1
236
+    layeringDefinition:
237
+      layer: site
238
+    storagePolicy: cleartext
239
+  data: another-secret-password
240
+  ---
229 241
   # Destination document.
230 242
   schema: armada/Chart/v1
231 243
   metadata:
@@ -241,12 +253,22 @@ Example
241 253
           schema: deckhand/Passphrase/v1
242 254
           name: example-password
243 255
           path: .
256
+      - dest:
257
+          path: .chart.values.script
258
+          pattern: INSERT_ANOTHER_PASSWORD
259
+        src:
260
+          schema: deckhand/Passphrase/v1
261
+          name: another-password
262
+          path: .
244 263
   data:
245 264
     chart:
246 265
       details:
247 266
         data: here
248 267
       values:
249 268
         some_url: http://admin:INSERT_PASSWORD_HERE@service-name:8080/v1
269
+        script: |
270
+         some_function("INSERT_ANOTHER_PASSWORD")
271
+         another_function("INSERT_ANOTHER_PASSWORD")
250 272
 
251 273
 After document rendering, the output for ``example-chart-01`` (the destination
252 274
 document) will be:
@@ -267,6 +289,9 @@ document) will be:
267 289
         # Notice string replacement occurs at exact location specified by
268 290
         # ``dest.pattern``.
269 291
         some_url: http://admin:my-secret-password@service-name:8080/v1
292
+        script: |
293
+         some_function("another-secret-password")
294
+         another_function("another-secret-password")
270 295
 
271 296
 Recursive Replacement of Patterns
272 297
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Loading…
Cancel
Save