rs-consul
This crate provides access to a set of strongly typed apis to interact with consul (https://www.consul.io/)
Installation
Simply include the rs-consul in your Cargo dependencies.
[]
= "0.9.0"
Usage
Check /examples for more detailed usage
Initialize the client
Environment Configuration (Recommended)
The client can be configured automatically using environment variables:
use ;
let consul_config = from_env;
let consul = new;
Manual Configuration
Alternatively, you can configure the client manually:
let consul_config = Config ;
let consul = new;
Register a Service
let node_id = "root-node"; //node name
let service_name = "new-service-1"; //service name
let payload = RegisterEntityPayload ;
consul.register_entity.await.unwrap;
Deregister a service
let node_id = "root-node";
let service_name = "new-service-1";
let payload = DeregisterEntityPayload ;
consul.deregister_entity.await.unwrap;
Development
Tests
Local Consul
Start consul locally with a docker image.
CI Consul
In CI, we start a service container for the test.
Running Tests
Contributions
For contributions, please:
- Make a pull request
- Make sure the tests pass
- Add a bullet to the Changelog
License
rs-consul is available under the MIT license. See LICENSE for details.