I have a .painless file as mentioned below. As of now, the ctx.vars.var1 have hardcoded values in my original file, which now need to be retrieved from a YAML file. All these files are in same project, so relative path will not be an issue.
if(ctx.metadata.Env == 'dev1' || ctx.metadata.Env == 'qa9' {
ctx.vars.var1 = 'get this value from a YAML file';
ctx.vars.var2 = 'get this value from a YAML file';
}
An example of YAML file and its content as below. The file name can be SomeFile.yaml, which resides in the same solution.
- name: Key1
value: Value1
- name: Key2
value: Value2
I need assistance how to extract the values from the YAML file and place them into those ctx.vars.var1 and var2 variables. Any help will be appreciated as I need to incorporate in my project.