Splitting a string of locations for Service Discovery

My service discovery backend returns a location string such as: “host1:port1,host2:port2”, How can I set up my api to split up the string and use a random location to serve my request. I believe this can be acheived the target list option but am confused as to how to correctly configure it.

Thanks

What SD is it? There’s examples of the settings in the tests for most of the popular ones:

https://github.com/TykTechnologies/tyk/blob/master/service_discovery_test.go

IF you can give us the full output object and it;s for a popular system we can always add a test.

Hey Martin,

Thanks for the link, it was super helpful to see what format tyk expects when parsing an etcd response. After mimicking the etcd nested list options I have tyk successfully configured.

Follow up question: how does tyk decide what host/port combo to use? Is it round robin or random?

It’s round robin :slight_smile: