HomeDisk/types/src/config/types.rs

33 lines
778 B
Rust
Raw Normal View History

2022-04-19 19:10:36 +00:00
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Config {
pub http: ConfigHTTP,
pub jwt: ConfigJWT,
2022-04-24 19:31:50 +00:00
pub storage: ConfigStorage,
2022-04-19 19:10:36 +00:00
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConfigHTTP {
2022-06-07 20:36:26 +00:00
/// HTTP Host
2022-04-19 19:10:36 +00:00
pub host: String,
2022-06-07 20:36:26 +00:00
/// Port HTTP Port
2022-04-19 19:10:36 +00:00
pub port: u16,
2022-06-07 20:36:26 +00:00
/// CORS Domaing (e.g ["site1.example.com", "site2.example.com"])
2022-04-19 19:10:36 +00:00
pub cors: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConfigJWT {
2022-06-07 20:36:26 +00:00
/// JWT Secret string
2022-04-19 19:10:36 +00:00
pub secret: String,
2022-06-07 20:36:26 +00:00
/// Token expiers time in seconds
2022-04-23 10:52:56 +00:00
pub expires: i64,
2022-04-19 19:10:36 +00:00
}
2022-04-24 19:31:50 +00:00
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConfigStorage {
2022-06-07 20:36:26 +00:00
/// Directory where user files will be stored
2022-04-24 19:31:50 +00:00
pub path: String,
}