-
Notifications
You must be signed in to change notification settings - Fork 2
YAML Usage
This guide explains how to configure Templify for YAML files, allowing for the substitution of specific fields with defined placeholders, simplifying the setup of project-specific values.
Templify uses a YAML configuration file with the structure below to enable replacement of specific values in the project’s YAML files.
steps:
- kind: YmlHandler
apiVersion: v1
spec:
- files:
- yamls/generic1.yml
placeholders:
- match: mappings[0].file
replace: newFile
- match: mappings[0].placeholders[0].query
replace: templify.query.project.groupId
- match: mappings[0].placeholders[0].name
replace: templify.replace.map.groupId
- match: mappings[0].placeholders[1].query
replace: templify.match.project.artifactId
- match: mappings[0].placeholders[1].name
replace: templify.replace.map.artifactId
Defines a list of steps for Templify to execute. Each step specifies the handler type for a specific file (in this case, YmlHandler
).
Specifies the handler type that will process the file.
Indicates the version of the API for handling XML configurations. Ensure compatibility by matching the correct API version.
The element in the spec
array defines a set of files to be processed along with specific placeholders.
Each spec
item contains:
-
files
: Specifies the Yaml files in which replacements will occur. The paths are relative to the root of the project. -
placeholders
: Defines the placeholder operations within each file, where:-
match
: The YAML path to be located in the file. We use the YAMLPath project structure. -
replace
: Specifies the placeholder value that will substitute the matched content. This value can reference an item in thetemplify
configuration, providing flexibility to customize the output.
-
You can see this example working here