Crates.io | discovery_rust |
lib.rs | discovery_rust |
version | 0.1.1 |
source | src |
created_at | 2018-05-30 06:35:15.125096 |
updated_at | 2018-09-13 07:06:59.010875 |
description | Discovery for rust |
homepage | https://github.com/da2018/discovery |
repository | https://github.com/da2018/discovery |
max_upload_size | |
id | 67714 |
size | 16,019 |
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.xx.com:8500
extern crate discovery_rust;
use discovery_rust::Discovery;
fn main() {
let mut discovery = Discovery::new_discovery("mysql".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'