-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
39 lines (29 loc) · 806 Bytes
/
lib.rs
File metadata and controls
39 lines (29 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use log::info;
#[cfg(feature = "blocking")]
pub mod client;
#[cfg(feature = "blocking")]
use reqwest::blocking::Client;
#[cfg(not(feature = "blocking"))]
pub mod client_async;
#[cfg(not(feature = "blocking"))]
use reqwest::Client;
pub mod shared {
pub use datafeed_cache_shared::*;
}
pub struct DatafeedClient {
client: Client,
base_url: String,
}
const BASE_DEFAULT: &'static str = "https://df.vatsim-germany.org";
impl DatafeedClient {
pub fn new() -> Self {
let _ = env_logger::try_init();
let _ = dotenv::dotenv();
let base_url: String = dotenv::var("BASE_URL").unwrap_or(BASE_DEFAULT.to_string());
info!("Selected BASE_URL: {}", base_url);
DatafeedClient {
client: Client::default(),
base_url,
}
}
}