The confd maven plugin aims at integrating confd, a lightweight configuration management tool, with maven.
Because we use extensively confd to deal with our environment dependant application configuration files (in a docker data-container for instance), and because we want to use the same tool everywhere, starting with the developer workstation, we needed to be able to use confd templates and configuration files inside a maven build.
The confd-maven-plugin hence allows you to use confd templates inside your project (instead of using the classical filtering features provided by default by Maven)
Note: because confd is currently not available for the Windows operating system, we provide a workaround in the form of a (very) basic java implementation of confd (only for the env backend) that
only supports the getv
template function like in the {{getv "/myapp/database/url"}}
example.
The confd-maven-plugin provides the notion of processor, that will condition the type of confd binary that will be use. The plugin currently supports 2 processors:
the local-confd-processor
that uses a real confd binary. You can specify your confd binary path by setting the binary.path
property.
the java-processor
(for windows users) that uses the java confd port
To make the confd-maven-plugin work, you have 3 kind of inputs to provide:
the equivalent of the TOML resource config
that you can specify inside the configuration of the plugin (used by the prepare
goal)
the templates that will be processed (file ending by the .tmpl
extension by convention, used by the process
goal)
the dictionary file that consists in a set of key/value pairs (used by the process
goal)
The typical usage of this plugin will be to trigger 2 differents kind of execution, through maven profiles. One for the developer workstation, that will
trigger both the prepare
and the process
goals, and one dedicated to prepare something like a zip or a targz file, containing
the templates and the resource config files, targeted to be used on production like environment. See the examples
section.
The confd-maven-plugin has two goals:
confd:prepare: generates the TOML files that can be used by the process
goal or in order to prepare a config templates bundle for later usage
confd:process: process the templates locally