diff --git a/dashboard/src/app.rs b/dashboard/src/app.rs index 8bf4af7..10ed9a2 100644 --- a/dashboard/src/app.rs +++ b/dashboard/src/app.rs @@ -28,13 +28,23 @@ impl Dashboard { pub async fn new(config_path: Option, headless: bool) -> Result { info!("Initializing dashboard"); - // Load configuration - config file is required + // Load configuration - try default path if not specified let config = match config_path { Some(path) => DashboardConfig::load_from_file(&path)?, None => { - error!("Configuration file is required. Use --config to specify path."); - error!("Dashboard configuration must be provided - no hardcoded defaults allowed."); - return Err(anyhow::anyhow!("Missing required configuration file")); + // Try default NixOS config path + let default_path = "/etc/cm-dashboard/dashboard.toml"; + match DashboardConfig::load_from_file(default_path) { + Ok(config) => { + info!("Using default config file: {}", default_path); + config + } + Err(e) => { + error!("Configuration file is required. Use --config to specify path or ensure {} exists.", default_path); + error!("Failed to load default config: {}", e); + return Err(anyhow::anyhow!("Missing required configuration file")); + } + } } }; diff --git a/dashboard/src/main.rs b/dashboard/src/main.rs index 30dd11c..2528737 100644 --- a/dashboard/src/main.rs +++ b/dashboard/src/main.rs @@ -20,7 +20,7 @@ struct Cli { #[arg(short, long, action = clap::ArgAction::Count)] verbose: u8, - /// Configuration file path (required) + /// Configuration file path (defaults to /etc/cm-dashboard/dashboard.toml) #[arg(short, long)] config: Option,