Server tools to backfill, tail, mirror, and verify PLC logs
at main 24 lines 731 B view raw
1use reqwest::Client; 2use reqwest_middleware::{ClientBuilder, ClientWithMiddleware}; 3use reqwest_retry::{RetryTransientMiddleware, policies::ExponentialBackoff}; 4use std::sync::LazyLock; 5 6pub const UA: &str = concat!( 7 "allegedly, v", 8 env!("CARGO_PKG_VERSION"), 9 " (from @microcosm.blue; contact @bad-example.com)" 10); 11 12pub static CLIENT: LazyLock<ClientWithMiddleware> = LazyLock::new(|| { 13 let inner = Client::builder() 14 .user_agent(UA) 15 .gzip(true) 16 .build() 17 .expect("reqwest client to build"); 18 19 let policy = ExponentialBackoff::builder().build_with_max_retries(12); 20 21 ClientBuilder::new(inner) 22 .with(RetryTransientMiddleware::new_with_policy(policy)) 23 .build() 24});