admin_config/
session_config.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct SessionConfig {
5    /// Session 密钥
6    pub secret_key: String,
7    /// 过期时间(秒)
8    pub max_age: u64,
9    /// 是否仅 HTTP 访问
10    pub http_only: bool,
11    /// 是否仅 HTTPS 访问
12    pub secure: bool,
13    /// Cookie 路径
14    pub cookie_path: String,
15    /// Cookie 域名
16    pub cookie_domain: Option<String>,
17}
18
19impl Default for SessionConfig {
20    fn default() -> Self {
21        Self {
22            secret_key: "".to_string(),
23            max_age: 86400,
24            http_only: true,
25            secure: false,
26            cookie_path: "/".to_string(),
27            cookie_domain: None,
28        }
29    }
30}