apollo-rust-client
A Rust client for Apollo Configuration centre.
Features
- Support for multiple namespaces
- Configuration updates via polling
- Type-safe configuration management
- Async/await support
- Error handling with detailed diagnostics
Installation
Add the following to your Cargo.toml
:
[]
= "0.2.0"
Alternatively, you can use the following command to use the WebAssembly version.
npm install @qqiao/apollo-rust-client
Usage
Basic Example
You can use the rust version as follows:
use Client;
use ClientConfig;
async
Or the JavaScript version:
import from '@qqiao/apollo-rust-client';
const clientConfig = ;
// Set other configuration settings
clientConfig. = "your_secret";
const client = ;
const namespace = client.;
console.log;
// Please make absolutely sure that you call the `free` method on WASM objects
// to prevent any memory leaks:
namespace.;
client.;
clientConfig.;
Configuration
The client supports the following configuration options:
app_id
: Your application ID in Apollocluster
: The cluster name (default: "default
")secret
: The optional secret for the givenapp_id
config_server
: The address of the configuration servercache_dir
: Directory to store local cache (default: "/opt/data/${app_id}/config-cache
")label
: The label of the current instance. Used to identify the current instance for a grayscale release.ip
: The IP address of your application. Used to identify the current instance for a grayscale release.
TODO
Cargo.toml
update for better conditional compilation. Although everything works just fine currently, due to the fact that all dependencies are listed flat, automation and IDEs are slowed down significantly.- Added other namespace format supports, for example YAML, JSON etc.
- Documentations in other languages.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.