banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Examples

banshee/examples-collection/examples/api/

consul-key

Example: url.encode and base64.decode; the value of a key of Consul.

  • example
  • api
  • consul
  • base64
  • encoding
  • http

by banshee1 installation1 version

v1Latest

Published on October 27, 2026. First version in this collection.

A key of Consul

A key of the key/value store of Consul, read by its HTTP API: its name goes into the address, each part encoded; its value comes back in base64.

How to read it

  • url.encode($part): the text written to fit in an address, a blank as %20, a / as %2F. Each part of the name is encoded apart, and the / between them kept, since Consul reads them as levels.
  • text.split and text.join cut the name and put it back together; list.add builds the list of the encoded parts.
  • Consul answers a list of one entry, [{"Key": …, "Value": "b2Zm"}]: $entries[0]['Value'].
  • base64.decode gives the text the base64 writes: b2Zm is off. A text that is not base64 stops the collector, unreachable.

To adapt it

  • A Consul with ACLs wants a token: $token = need('protocol:http:token') and headers=array('X-Consul-Token' => $token).