Service discovery client for Rust based on consul
You need to set environment variable for test env SERVICE_DISCOVERY_URI
e.g.
export SERVICE_DISCOVERY_URI=consul://discovery.dev.zhihu.com:8500
extern crate discovery_rust;
use discovery_rust::Discovery;
fn main() {
let mut discovery = Discovery::new_discovery("tseqd".to_string(), None);
let addr = discovery.get_address();
println!("{}", addr);
}
Support random and roundrobin.
Also you can cover discovery uri by setting environment variable for debug. e.g. SERVICE_NAME -> redis
export REDIS_SERVICE_ADDRESS = '127.0.0.1:8080'