use serde::{Deserialize, Serialize};
use std::net::SocketAddr;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DashboardConfig {
pub bind_address: SocketAddr,
pub enable_cors: bool,
pub storage_path: String,
pub max_page_size: usize,
pub default_page_size: usize,
pub cache_size_mb: usize,
pub auto_refresh_interval_secs: u64,
}
impl Default for DashboardConfig {
fn default() -> Self {
Self {
bind_address: "127.0.0.1:3000".parse().unwrap(),
enable_cors: false,
storage_path: "otelite.db".to_string(),
max_page_size: 1000,
default_page_size: 100,
cache_size_mb: 10,
auto_refresh_interval_secs: 1,
}
}
}
impl DashboardConfig {
pub fn with_bind_address(mut self, addr: SocketAddr) -> Self {
self.bind_address = addr;
self
}
pub fn with_cors(mut self, enable: bool) -> Self {
self.enable_cors = enable;
self
}
pub fn with_storage_path(mut self, path: impl Into<String>) -> Self {
self.storage_path = path.into();
self
}
}