CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 4m3s
CI / Security Audit (push) Successful in 1m38s
CI / Tests (push) Successful in 4m44s
CI / Detect Changes (push) Successful in 2s
CI / Deploy Agent (push) Successful in 2s
CI / Deploy Dashboard (push) Successful in 2s
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Failing after 2s
22 lines
825 B
Rust
22 lines
825 B
Rust
use compliance_core::DashboardConfig;
|
|
|
|
use super::error::DashboardError;
|
|
|
|
pub fn load_config() -> Result<DashboardConfig, DashboardError> {
|
|
Ok(DashboardConfig {
|
|
mongodb_uri: std::env::var("MONGODB_URI")
|
|
.map_err(|_| DashboardError::Config("Missing MONGODB_URI".to_string()))?,
|
|
mongodb_database: std::env::var("MONGODB_DATABASE")
|
|
.unwrap_or_else(|_| "compliance_scanner".to_string()),
|
|
agent_api_url: std::env::var("AGENT_API_URL")
|
|
.unwrap_or_else(|_| "http://localhost:3001".to_string()),
|
|
dashboard_port: std::env::var("DASHBOARD_PORT")
|
|
.ok()
|
|
.and_then(|p| p.parse().ok())
|
|
.unwrap_or(8080),
|
|
mcp_endpoint_url: std::env::var("MCP_ENDPOINT_URL")
|
|
.ok()
|
|
.filter(|v| !v.is_empty()),
|
|
})
|
|
}
|