admin_config/
security_config.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct SecurityConfig {
5 pub aes_key: String,
7 pub aes_iv: String,
9 pub enable_cors: bool,
11 pub allowed_origins: String,
13 pub enable_csrf: bool,
15}
16
17impl Default for SecurityConfig {
18 fn default() -> Self {
19 Self {
20 aes_key: "".to_string(),
21 aes_iv: "".to_string(),
22 enable_cors: true,
23 allowed_origins: "".to_string(),
24 enable_csrf: false,
25 }
26 }
27}
28
29impl SecurityConfig {
30 pub fn allowed_origins_list(&self) -> Vec<String> {
31 self.allowed_origins.split(',').map(|s| s.trim().to_string()).collect()
32 }
33}