consul-oxide
is a library for interacting with Consul agents via their HTTP API.
Consul is a service mesh solution providing a full featured control plane
with service discovery, configuration, and segmentation functionality.
For more information on what Consul is, read the Consul documentation.
This library is a fork of consul-rust by pierresouchay and contributors. Full credit goes to them for the original library.
consul-oxide
is still under development, and its API is changing very rapidly. This library is not (yet) ready for production use!
The key features of Consul, and thus this crate, are:
- Service Discovery
- Health Checking
- KV Store
- Secure Service Communication
- Multi Datacenter Support
consul-oxide
aims to support all of these to the best of its ability. Each feature is available as a compiler feature, and can be enabled by using the discovery
, health
, kv
, ssc
and mds
features respectively. By default, all features are enabled.
The Client
struct provides the main entry point for the library.
let config = Config::new().unwrap();
let client = Client::new(config);
You can pass in custom configuration by using the Config
datatype. By
default, it will assume the Consul agent is running on localhost, on the
default port 8500.
Requests can be made to the Consul agent by importing the relevant trait:
use consul_oxide::Agent;
let client = Client::new(Config::new().unwrap());
let agents = client.agents(false).await;
Simply include the consul-oxide in your Cargo dependencies.
[dependencies]
consul_oxide = "0.5"
The library is designed to be fully async compatible, and works with both
the tokio
and async-std
runtimes. At this time, there is no blocking API
available. As an alternative, you can use versions of this library below
0.5.0
, as these are blocking.
consul-oxide
is licensed under a combined MIT/Apache-2.0 license. See the LICENSE-MIT
and LICENSE-APACHE
file for more information.