Skip to content

rikcarve/consulkv-maven-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Central License: MIT

consulkv-maven-plugin

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 :-)

Add plugin

            <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>

Configuration

  • 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

Link

https://github.com/rikcarve/mp-config-consul

CLI

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:

usage: ConsulKvCli
 -configDirs <arg>   comma separated list of directories (absolute)
                     containing property files
 -prefix <arg>       consul key prefix
 -url <arg>          consul url

CLI docker image

In case you can use docker (and I hope you can), there's also a docker image :-)

Build

mvn package docker:build -Pcli

Run

docker run rikcarve/consulkv -configDirs /patch/to/config

About

Put application config into consul from your maven build

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages