git2consul是一個Consul社區(qū)項目,將文件從git存儲庫加載到各個密鑰到Consul。默認(rèn)情況下,密鑰的名稱是文件的名稱。YAML和Properties文件分別支持.yml和.properties的文件擴(kuò)展名。將spring.cloud.consul.config.format屬性設(shè)置為FILES。例如:
bootstrap.yml
spring:
? cloud:
? ? consul:
? ? ? config:
? ? ? ? format: FILES
給定/config中的以下密鑰,development配置文件和應(yīng)用程序名稱為foo:
.gitignore
application.yml
bar.properties
foo-development.properties
foo-production.yml
foo.properties
master.ref
將創(chuàng)建以下屬性來源:
config/foo-development.properties
config/foo.properties
config/application.yml
每個鍵的值需要是一個格式正確的YAML或Properties文件。