wechat_backend_auth/
config.rs1use crate::types::{AppId, AppSecret};
2use std::time::Duration;
3use typed_builder::TypedBuilder;
4
5#[derive(Debug, Clone, TypedBuilder)]
7pub struct HttpConfig {
8 #[builder(default = Duration::from_secs(30))]
10 pub timeout: Duration,
11
12 #[builder(default = Duration::from_secs(10))]
14 pub connect_timeout: Duration,
15
16 #[builder(default = 3)]
18 pub max_retries: u32,
19
20 #[builder(default = Duration::from_secs(1))]
22 pub retry_delay: Duration,
23}
24
25impl Default for HttpConfig {
26 fn default() -> Self {
27 Self::builder().build()
28 }
29}
30
31#[derive(Debug, Clone, TypedBuilder)]
33pub struct BackendConfig {
34 pub app_id: AppId,
36
37 pub app_secret: AppSecret,
39
40 #[builder(default)]
42 pub http: HttpConfig,
43}
44
45impl BackendConfig {
46 pub fn app_id(&self) -> &AppId {
48 &self.app_id
49 }
50
51 pub fn app_secret(&self) -> &AppSecret {
53 &self.app_secret
54 }
55
56 pub fn http_config(&self) -> &HttpConfig {
58 &self.http
59 }
60}