How to setup array entries in appsettings.json

according to Structured configuration variables | Documentation and Support (octopus.com)

it only shows how to modify array entries, which isn’t too useful. I need to be able to add array entries for different deploys.

How to do this?

ie lets say I have some json

{
“Services”: []
}

I need to add things to the Services array.

Hi @Keith_Nicholas,

Thanks for reaching out, I’d be happy to help with replacing JSON array values with our Structured Configuration Variables feature!

The docs linked has some examples further down for replacing an entire array or specific indexes:

It’s possible to replace an entire array or sequence too. In the previous example, if the Octopus variable foo:bar was set to ["baz","qux"]

So for the JSON shared above, setting an Octopus variable called Services with a value including the array e.g. ["service1","service2"] will replace the entire array value, alternatively you can target specific items in the array using indexes in the variable name e.g. Services:0: instead.

Hope that helps but feel free to reach out with any questions or issues at all!

Best Regards,

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.