Sabbir Ahmed
Jan 9, 2023

--

Yes, init() functions should be used sensibly. In our case, we are using Consul as a Service Discovery and a Config store. So, if the application fails to fetch the KV from Consul ie. for any downtime, I want my app to “fail-first”.

But if I were to use Consul just as a service discovery, I would probably use it in any other module and handle Service Discovery errors gracefully. So that when the consul service recovers we can have our app registered automatically. Hope this helps, let me know if you have any other questions.

--

--

Sabbir Ahmed
Sabbir Ahmed

No responses yet