| Crates.io | sift_connect |
| lib.rs | sift_connect |
| version | 0.7.2 |
| created_at | 2025-04-01 19:01:34.145745+00 |
| updated_at | 2026-01-16 22:32:37.479618+00 |
| description | A convenient and opinionated way to connect to the Sift API |
| homepage | https://github.com/sift-stack/sift |
| repository | https://github.com/sift-stack/sift |
| max_upload_size | |
| id | 1615300 |
| size | 57,809 |
sift_connect is a convenience crate that makes it simple to create a gRPC connection to
Sift. Most users won't need to install this crate as it's re-exported in other crates. The
following is an example of how to create a gRPC connection to Sift using sane defaults.
use sift_connect::{Credentials, SiftChannelBuilder};
use std::env;
let credentials = Credentials::Config {
uri: env::var("SIFT_URI").unwrap(),
apikey: env::var("SIFT_API_KEY").unwrap(),
};
let grpc_conn = SiftChannelBuilder::new(credentials)
.build()
.unwrap();
Credentials can also be loaded from a sift.toml file stored in a the user's local config
directory.
The following is an example of a valid sift.toml file:
uri = "http://example-sift-api.com"
apikey = "example-sift-api-key"
[mission]
uri = "http://example-sift-api.com"
apikey = "my-other-sift-api-key"
The top-level TOML table is considered the default profile, with the mission table being a
named profile. To reference the default profile:
use sift_connect::{Credentials, SiftChannelBuilder};
use std::env;
let credentials = Credentials::Profile(None);
let grpc_conn = SiftChannelBuilder::new(credentials)
.build()
.unwrap();
To reference the mission profile:
use sift_connect::{Credentials, SiftChannelBuilder};
use std::env;
let credentials = Credentials::Profile(Some("mission".into()));
let grpc_conn = SiftChannelBuilder::new(credentials)
.build()
.unwrap();