spring-cloud-consul
spring-cloud-consul copied to clipboard
Create property to allow characters that are not valid in a dns name.
I want the service name to have forward slash(example users/v1/profile), but slash get replaced with hyphen(-).
Why are we replacing / from service name while consul support it and return the service details using http and DNS interfaces. Also, Zuul does recognize the service with slash/s.
Example
- http://localhost:8500/v1/catalog/service/users/v1/profile
- dig @localhost -p 8600 users/v1/profile.service.consul
Zuul also respect users/v1/profile as a service name and route request to host and port give as part of service registry.
The replacement and validation is happening in ConsulLifecycle class.
Services by default are registered as DNS names in consul as well. Slashes aren't valid DNS characters. I'm away, but there may be an option to disable it.
There's no property to set. You'd have to override ConsulLifecycle.getServiceId()
.
In other words, a property that will turn normalizeForDns()
off. This has the side effect that the services won't be available via the consul DNS server.