Skip to content

An Apache DeltaSpike ConfigSource implementation for etcd.

License

Notifications You must be signed in to change notification settings

jasonhallford/EtcdConfigSource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EtcdConfigSource adds basic etcd support to the Apache DeltaSpike configuration mechanism. In particular, it has not been tested against a cluster configuration or with TLS. Both may come at a later time.

Building

You may build this project using Maven 3.5+ and OpenJDK 8. I use binaries provided by the AdoptOpenJDK project.

First, you'll need to clone the repo:

$ git clone https://github.com/jasonhallford/EtcdConfigSource.git

Then build with Maven:

$ mvn install -DskipITs

Here, -DskipITs is used to disable integration tests. You may run them, of course, but you'll need to configure a local etcd instance first.

If you prefer an IDE, I recommend IntelliJ IDEA's Community Edition, although any IDE with Maven support should suffice.

Downloading

A pre-built binary is available from this site's packages tab. You may download the JAR directly, or integrate Maven with GitHub packages and then use the provided coordinates (hint: you want the latest version of io.miscellanea.EtcdConfigSource).

Using

To use the EtcdConfigSource, simply place the JAR and its dependencies on the classpath. Integration with DeltaSpike is achieved via the Java Service Loader Framework. With the exception of setting a few parameters (see below), no additional configuration is required!

Parameters

The configuration source makes use of parameters to control runtime behavior. They may be set in two ways

  1. On the command line using -D (or any other means of invoking System.setProperty())
  2. Via a property file referenced using URL syntax.
Property Type Description
etcd.cs.configUrl String The URL for a .properties file containing the other properties listed in this table. For example, to reference a file named myEtcd.properties in /var/lib/etcd/ you'd use the URL file://var/lib/etcd/myEtcd.properties.
etcd.cs.keyPrefix String An optional prefix to prepend to a key before performin a lookup in the key space. This permits property injection to use a stable name that may be customized via configuration on a per-execution environment basis.
etcd.cs.ordinal Integer The ordinal used to determine the configuration source's priority order. Defaults to 1000 if omitted. Please see the DeltaSpike configuration mechanism page for more information.
etcd.cs.watch Boolean If true, then the configuration source will dynamically reload previously read etcd keys should they change. If false (the default), then each key's value is only read once.
etcd.endpoint.host String The etcd host's DNS name or IP address.
etcd.endpoint.members String A comma-separated list of etcd cluter members (e.g. "http://localhost:2379,http://localhost:2389"). When present, this property causes the config source to ignore etcd.endpoint.host and etcd.endpoint.port. Specifying a single-member list may be used as an alternative to these properties.
etcd.endpoint.password String The etcd user's password. Must be omitted if authentication is not required.
etcd.endpoint.port Integer The etcd server's TCP port. Defaults to 2379 if omitted.
etcd.endpoint.user String The name used to authenticate with the etcd server. Must be omitted if authentication in not required.
javax.net.ssl.trustStore String The absolute path to a java keystore containing the etcd server's TLS certificate. This property and javax.net.ssl.trustStorePassword are required for TLS-enabled endpoints.
javax.net.ssl.trustStorePassword String The trust store's password. This property and javax.net.ssl.trustStore are required for TLS-enabled endpoints.

Parameters may be specified on the command line and in a properties file. In that case, command line parameters take precedence, overriding any conflicting values in the file.

About

An Apache DeltaSpike ConfigSource implementation for etcd.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages