I was following the following tutorial on consul learn (https://learn.hashicorp.com/tutorials/consul/service-mesh-with-envoy-proxy). Everything makes sense to me up until the point where the envoy sidecar proxy is started with the command consul connect envoy -sidecar-for service-id.
Usually when I register a service in consul, I generate a random id for the service and for that matter, trying to start the proxy this way would be impossible because I do not know the generated id as at the time of starting the sidecar proxy. What I thought of was to programmatically start the sidecar proxy in the service during startup, that way I have access to the service id and then I use that to start it. Is there any way to do this programmatically?, are there different ways this can be done aside running the consul cli command?.
Thanks.