Fizcko / Azure_DevOps_Vault_Interaction

Azure DevOps extension to interact with HashiCorp Vault.
MIT License
10 stars 13 forks source link

Add new option tosupport for objectSplit for Arrays and Objects #14

Open chamel-shipbob opened 2 years ago

chamel-shipbob commented 2 years ago

This pr adds the field objectSplit and objectSeperator. During our use case, I noticed that the plugin formats arrays and dictionaries in a way that is not supportive of a full array or dictionary substitution. I added objectSplit which defaults to legacy behavior of each item getting its own line Default Behavior objectSplit=true, objectSeperator="." key = {"foo":[0,1,2]} breakdown into key.foo.0 = 0 key.foo.1 = 1 key.foo.2 = 2 New Behavior objectSplit=false, objectSeperator="." key = {"foo":[0,1,2]} breakdowns into key = {"foo":[0,1,2]}

The difference in legacy vs new behavior is how azure handles the substitution Default Behavior replaces only what is set New Behavior replaces the entire object so given the example above and the following appsetting json key = {"foo":[203],"bar":"hello"}

Default Behavior would become: key = {"foo":[0],"bar":"hello"} as only key that matches is the 0 index of the foo array(key.foo.0) New Behavior would replace on the "key" key and become: key = {"foo":[0,1,2]} as key is the object is "key" and foo.bar does not exist in the "key" object.