Skip to content

Retrieves configuration from HashiCorp Consul

License

Notifications You must be signed in to change notification settings

play-rconf/play-rconf-consul

Repository files navigation

Play Remote Configuration - HashiCorp Consul

Latest release JitPack Build GitHub license

Retrieves configuration from HashiCorp Consul


About this project

In production, it is not always easy to manage the configuration files of a Play Framework application, especially when it running on multiple servers. The purpose of this project is to provide a simple way to use a remote configuration with a Play Framework application.

How to use

To enable this provider, just add the classpath "io.playrconf.provider.ConsulProvider" and the following configuration:

remote-configuration {

  ## HashiCorp Consul
  # ~~~~~
  # Retrieves configuration from HashiCorp Consul
  consul {

    # API endpoint. HTTPS endpoint could be used,
    # but the SSL certificate must be valid
    endpoint = "http://127.0.0.1:8500/"
    endpoint = ${?REMOTECONF_CONSUL_ENDPOINT}

    # Authentication token. If ACL are anabled on
    # your Consul cluster, this variable allow you
    # to set the token to use with each API calls
    auth-token = ""
    auth-token = ${?REMOTECONF_CONSUL_AUTHTOKEN}

    # Prefix. Get only values with key beginning
    # with the configured prefix
    prefix = "/"
    prefix = ${?REMOTECONF_CONSUL_PREFIX}
  }
}

License

This project is released under terms of the MIT license.