79 lines
2.1 KiB
Rust
79 lines
2.1 KiB
Rust
|
|
use serde::{Deserialize, Serialize};
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
#[serde(rename_all = "camelCase")]
|
||
|
|
pub struct S3Config {
|
||
|
|
pub server: ServerConfig,
|
||
|
|
pub storage: StorageConfig,
|
||
|
|
pub auth: AuthConfig,
|
||
|
|
pub cors: CorsConfig,
|
||
|
|
pub logging: LoggingConfig,
|
||
|
|
pub limits: LimitsConfig,
|
||
|
|
pub multipart: MultipartConfig,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
#[serde(rename_all = "camelCase")]
|
||
|
|
pub struct ServerConfig {
|
||
|
|
pub port: u16,
|
||
|
|
pub address: String,
|
||
|
|
pub silent: bool,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
#[serde(rename_all = "camelCase")]
|
||
|
|
pub struct StorageConfig {
|
||
|
|
pub directory: String,
|
||
|
|
pub clean_slate: bool,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
#[serde(rename_all = "camelCase")]
|
||
|
|
pub struct AuthConfig {
|
||
|
|
pub enabled: bool,
|
||
|
|
pub credentials: Vec<Credential>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
pub struct Credential {
|
||
|
|
#[serde(rename = "accessKeyId")]
|
||
|
|
pub access_key_id: String,
|
||
|
|
#[serde(rename = "secretAccessKey")]
|
||
|
|
pub secret_access_key: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
#[serde(rename_all = "camelCase")]
|
||
|
|
pub struct CorsConfig {
|
||
|
|
pub enabled: bool,
|
||
|
|
pub allowed_origins: Option<Vec<String>>,
|
||
|
|
pub allowed_methods: Option<Vec<String>>,
|
||
|
|
pub allowed_headers: Option<Vec<String>>,
|
||
|
|
pub exposed_headers: Option<Vec<String>>,
|
||
|
|
pub max_age: Option<u64>,
|
||
|
|
pub allow_credentials: Option<bool>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
#[serde(rename_all = "camelCase")]
|
||
|
|
pub struct LoggingConfig {
|
||
|
|
pub level: Option<String>,
|
||
|
|
pub format: Option<String>,
|
||
|
|
pub enabled: Option<bool>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
#[serde(rename_all = "camelCase")]
|
||
|
|
pub struct LimitsConfig {
|
||
|
|
pub max_object_size: Option<u64>,
|
||
|
|
pub max_metadata_size: Option<u64>,
|
||
|
|
pub request_timeout: Option<u64>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
#[serde(rename_all = "camelCase")]
|
||
|
|
pub struct MultipartConfig {
|
||
|
|
pub expiration_days: Option<u64>,
|
||
|
|
pub cleanup_interval_minutes: Option<u64>,
|
||
|
|
}
|