1.0.0 • Published 8 years ago
cp-client v1.0.0
cp-client
ContainerPilot client for Node.js
API
The consul instance to connect to can be configured either through the config() function or through the following environment variables:
CONSUL_HOST: defaults to 'consul'CONSUL_PORT: defaults to 8500
config(config)
Configure cp-client with any of the following settings
consul- the base URL to use to connect to consul
getStatus(host, callback)
Get the /status results for a ContainerPilot configured service with the following arguments
host: object withaddressandportproperties. Should be thecontainerpilotregistered service in consul, as it will have the/statusendpoint.callback: function with the signature(err, status)wherestatusis an object of the parsed response from/status
getStatuses(callback)
Maps all status results to services configured in consul to have a telemetry endpoint. Please note that if a service isn't configured with telemetry then it will not exist in the resulting data.
callback: function with the signature(err, statuses)wherestatusesis an array of objects with the following structure:name- name of the registered service in consulhost- object withaddressandportproperties for thecontainerpilotservice registeredstatus- the parsed response from/status