fraiseql_core/config/
cors.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(default)]
8pub struct CorsConfig {
9 pub enabled: bool,
11
12 pub allowed_origins: Vec<String>,
14
15 pub allowed_methods: Vec<String>,
17
18 pub allowed_headers: Vec<String>,
20
21 pub expose_headers: Vec<String>,
23
24 pub allow_credentials: bool,
26
27 pub max_age_secs: u64,
29}
30
31impl Default for CorsConfig {
32 fn default() -> Self {
33 Self {
34 enabled: true,
35 allowed_origins: vec![], allowed_methods: vec!["GET".to_string(), "POST".to_string(), "OPTIONS".to_string()],
37 allowed_headers: vec![
38 "Content-Type".to_string(),
39 "Authorization".to_string(),
40 "X-Request-ID".to_string(),
41 ],
42 expose_headers: vec![],
43 allow_credentials: false,
44 max_age_secs: 86400, }
46 }
47}