I have a YAML file that i want to push it to Vault.
# values.yaml
db:
username: msql
pass: p$$ass
However, vault accepts only key/value pair namely secret engine v2.
vault kv secret/projects/craft/app-a mykey=value
If I can convert the YAML file into a properties file, i will get the key/value pair automatically. then, I can push its key/value pair .
I can see that the question Convert YAML file to Application.properties will answer my question.
However, the answers suggested some tools, however,it does not support yaml list format.
Also, the question was closed and no more accept answers !! ðŸ˜
I've tried other ways , but nothing seems to work.
How can I convert the YAML file to a full key path/value pairs.. which is at the end a properties file.
Because the original question Convert YAML file to Application.properties has been closed, I will answer here.
Indeed, yq CLI must be enough here :
yq r values.yaml --printMode pv "**" | sed 's/: /=/' > values.properties
explanation:
yq r : read yaml file--printMode pv : pv means Path-Value** : means all key paths.sed 's/: /=/' : if you run it without sed, the delimiter between path and value is : , while we need it to be =. So we need to replace : by = in each line (only the first occurrence)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With