snm_brightdata_client/
config.rs1use anyhow::Result;
3
4#[derive(Clone, Debug)]
5pub struct BrightDataConfig {
6 pub endpoint: String,
7 pub token: String,
8}
9
10impl BrightDataConfig {
11 pub fn new(endpoint: String, token: String) -> Result<Self> {
12 Ok(Self { endpoint, token })
13 }
14
15 pub fn from_env() -> Result<Self> {
16 let endpoint = std::env::var("BRIGHTDATA_ENDPOINT")
17 .unwrap_or_else(|_| "https://brd.superproxy.io".to_string());
18 let token = std::env::var("BRIGHTDATA_TOKEN")?;
19 Ok(Self { endpoint, token })
20 }
21}