1use std::time::Duration;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct AuthConfig {
6 pub secret: String,
8 pub public_paths: Vec<String>,
10}
11
12impl AuthConfig {
13 pub fn is_public(&self, path: &str) -> bool {
15 self.public_paths.iter().any(|item| item == path)
16 }
17}
18
19#[derive(Debug, Clone)]
21pub struct RestConfig {
22 pub name: String,
24 pub timeout: Duration,
26 pub max_body_bytes: usize,
28 pub auth: Option<AuthConfig>,
30}
31
32impl Default for RestConfig {
33 fn default() -> Self {
34 Self {
35 name: "rs-zero".to_string(),
36 timeout: Duration::from_secs(5),
37 max_body_bytes: 1024 * 1024,
38 auth: None,
39 }
40 }
41}