Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A shim for transparent access to Typesafe configurations stored in Consul

License

omnisis/consul-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Consul-Config

This is an extension to Typesafe Config to allow for the loading of one or more Config objects from paths in Consul KV. It is merely a convience to avoid having to have the command line installed and remembering to fetch the KV values to files before launching your app.

DISCLAIMER: This is currently a MVP created purely to scratch an itch. Pull requests are graciously accepted for features/bugs however 😉

Usage

Bootstrapping

The information about how to connect to your Consul server is read from a bootrap Config object. An example bootstrap configuration file looks as follows:


consul {
  configkeys          =   ["conf1", "conf2"]
  url                 =   "localhost:8500"
}

The value of configkeys is a list of keys in Consul that will be loaded in a first-come, first-served fashion from Consul and applied. The loading mechanism follows the standard override mechanism for System and Environmental variables.

Getting Consul Config into your Application

Application integration follows the standard ConfigFactory approach:

    // For standard configuration (finds bootstrap values in application.conf)
    Config conf = ConsulConfigFactory.load();

    // With a custom classloader and bootstrap conf location
    ClassLoader cl = ...
    Config conf = ConsulConfigFactory.load(cl, ConfigFactory.parseFile(new File("custom.conf")));

Building

With Gradle

$> gradlew build

TODO

  • Basic HTTP Support
  • Support HTTPS and advanced ConsulClient Options in Bootstrap Config

About

A shim for transparent access to Typesafe configurations stored in Consul

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published