Put application config into consul from your maven build.
Configuration of an application is often tightly coupled with the feature/version of you code. Keeping them together helps a lot in CI/CD pipelines. As there are many ways putting your config into Consul for production, having a maven plugin simplifies sytsem tests a lot. Put your config into consul in the pre-integration test phase, build and start your docker container and voila, your tests work as if they are a live system :-)
<plugin>
<groupId>ch.carve</groupId>
<artifactId>consulkv-maven-plugin</artifactId>
<version>0.2</version>
<configuration>
<url>localhost</url>
<configDirs>
<configDir>src/main/resources/consul</configDir>
<configDir>src/main/resources/consul/dev</configDir>
</configDirs>
<prefix>hello</prefix>
</configuration>
</plugin>
- url: url to consul, e.g. localhost, or 192.168.99.100:8500
- prefix: prefix for the key, e.g. app --> app/key = value
- configDirs: one or multiple configDir directories with property files
https://github.com/rikcarve/mp-config-consul
There's also a cli version which can be used for staging and production deployment in case maven is not option there. You can build it through:
mvn package -Pcli
usage: ConsulKvCli
-configDirs <arg> comma separated list of directories (absolute)
containing property files
-prefix <arg> consul key prefix
-url <arg> consul url
In case you can use docker (and I hope you can), there's also a docker image :-)
mvn package docker:build -Pcli
docker run rikcarve/consulkv -configDirs /patch/to/config