3 releases
Uses new Rust 2024
| 0.1.2 | Nov 27, 2025 |
|---|---|
| 0.1.1 | Nov 27, 2025 |
| 0.1.0 | Nov 26, 2025 |
#6 in #nacos
17KB
171 lines
Install
cargo add ez-rust-discovery
Usage Example
fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO Start gRPC or HTTP service.
let manager = ServiceManager::new(ServeOptions::default())?;
if let Err(e) = manager.online() {
println!("online fail, caused by: {}", e);
std::process::exit(1);
};
std::thread::sleep(std::time::Duration::from_secs(30));
// TODO block Listen signal...
// Go offline before the gRPC or HTTP service shuts down
manager.offline()?;
// TODO Close gRPC or HTTP service.
Ok(())
}
Environment
| Name | Description | Default value |
|---|---|---|
| NACOS_ADDR | Nacos server address | |
| NACOS_NAMESPACE | Service namespace | public |
| SERVICE_ADDR | Service address | |
| SERVICE_NAME | Service name |
Dependencies
~13–27MB
~274K SLoC