Externalizing environmental config using Consul and envconsul

In the previous recipe, we had our Consul service installed and experimented with its Key/Value capabilities to learn how we can manipulate the data in it. Next step would be to integrate Consul with our application and make the data extraction process seamless and non-invasive from the application's stand point.

As we don't want our application to know anything about Consul and have to explicitly connect to it—even though such a possibility exists—we will employ another utility, also created and open-sourced by Hashicorp, called envconsul to connect to the Consul service for us, extract the specified configuration key/value tree, and expose it as the environment variables to be used ...

Get Spring Boot Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.