in my cloud config I have this my-app.yml
spring:
profiles: dev
roles:
- nerds
- staff
but it appears to be serializing like so:
"source": {
"roles[0]": "nerds",
"roles[1]": "staff"
}
instead of
"source": {
"roles": [
"nerds",
"staff"
]
}
if I'm consuming my config from a node app, I now have to find all the props that match a regex /^roles
and parse out the array, instead of just getting an array back natively.
Is there someway to configure cloud config to just return native arrays instead of decomposing it into indexed keys of an object?
As far as I know, there is no configuration to make config server serve native arrays because yml file is just an alternative representation of properties file in spring boot.
Instead, you can access your config server from your node application with the different endpoints that config server supports like belows.
/{application}-{profile}.yml
/{label}/{application}-{profile}.yml
{profile}
can be multiple values that is separated by command(,). If you access your config server with one of above, config will be served as native yaml format that has the exactly same contents - already merged and overrided properties from multiple files - and it have array values as yaml list like you want. You can easily parse yaml to JSON in node.js as you know. I think that it could be a alternative solution for you.
You can find other endpoints that config server supports here - quick start section.