Git2consul is a consul community project that loads files from a git repository into individual keys to consul. By default, the name of the key is the name of the file. Yaml and properties files support the. yml and. Properties file extensions, respectively. Set the Spring.cloud.consul.config.format property to files. For example:
Bootstrap.yml
spring: cloud: consul: config: format: FILES
Given the following key in the/config, the development configuration file and application name is foo:
gitignoreapplication.ymlbar.propertiesfoo-development.propertiesfoo-production.ymlfoo.propertiesmaster.ref
The following attribute sources will be created:
config/foo-development.propertiesconfig/foo.propertiesconfig/application.yml
The value of each key needs to be a properly formatted YAML or properties file.
Fast failure
In some cases, such as local development or some test scenarios, it may be convenient to not fail if the consul cannot be configured. Setting Spring.cloud.consul.config.failfast=false in Bootstrap.yml causes the configuration module to record a warning instead of throwing an exception. This will allow the application to continue to start normally.
Spring Cloud Consul-git2consul and configuration