Tecsisa / constructr-consul

This library enables to use Consul as cluster coordinator in a ConstructR based node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for Consul HTTP tokens

alonsodomin opened this issue · comments

Current implementation does not have support for sending a HTTP token in the request to Consul, which is needed when Consul servers have been setup with ACL requirements in the KV store:
https://www.consul.io/docs/agent/http.html

Users should be able to (at least) pass an HTTP token via configuration, for example:

constructr {
  coordination {
    host = "<consul-server>"
    port = 8500
  }

  consul {
    http-token = "<consul-token>"
    agent-name = "<consul-agent>"
  }
}

The token value is optional and in case is specified, it should be added to every request done from the coordination implementation. Consul provides the option of including it as a token query string parameter or as a X-Consul-Token HTTP header. The latter should be preferred.