All checks were successful
Build and Release / build-and-release (push) Successful in 2m7s
- Add ServiceLogConfig structure for per-host service log paths - Implement L key handler for custom log file viewing via tmux popup - Update dashboard config to support service_logs HashMap - Add tail -f command execution over SSH for real-time log streaming - Update status line to show L: Custom shortcut - Document configuration format in CLAUDE.md Each service can now have custom log file paths configured per host, accessible via L key with same tmux popup interface as journalctl.
76 lines
2.0 KiB
Rust
76 lines
2.0 KiB
Rust
use anyhow::Result;
|
|
use serde::{Deserialize, Serialize};
|
|
use std::path::Path;
|
|
|
|
/// Main dashboard configuration
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct DashboardConfig {
|
|
pub zmq: ZmqConfig,
|
|
pub hosts: HostsConfig,
|
|
pub system: SystemConfig,
|
|
pub ssh: SshConfig,
|
|
pub service_logs: std::collections::HashMap<String, Vec<ServiceLogConfig>>,
|
|
}
|
|
|
|
/// ZMQ consumer configuration
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ZmqConfig {
|
|
pub subscriber_ports: Vec<u16>,
|
|
}
|
|
|
|
/// Hosts configuration
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct HostsConfig {
|
|
pub predefined_hosts: Vec<String>,
|
|
}
|
|
|
|
/// System configuration
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct SystemConfig {
|
|
pub nixos_config_git_url: String,
|
|
pub nixos_config_branch: String,
|
|
pub nixos_config_working_dir: String,
|
|
pub nixos_config_api_key_file: Option<String>,
|
|
}
|
|
|
|
/// SSH configuration for rebuild operations
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct SshConfig {
|
|
pub rebuild_user: String,
|
|
pub rebuild_alias: String,
|
|
}
|
|
|
|
/// Service log file configuration per host
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ServiceLogConfig {
|
|
pub service_name: String,
|
|
pub log_file_path: String,
|
|
}
|
|
|
|
impl DashboardConfig {
|
|
pub fn load_from_file<P: AsRef<Path>>(path: P) -> Result<Self> {
|
|
let path = path.as_ref();
|
|
let content = std::fs::read_to_string(path)?;
|
|
let config: DashboardConfig = toml::from_str(&content)?;
|
|
Ok(config)
|
|
}
|
|
}
|
|
|
|
impl Default for DashboardConfig {
|
|
fn default() -> Self {
|
|
panic!("Dashboard configuration must be loaded from file - no hardcoded defaults allowed")
|
|
}
|
|
}
|
|
|
|
impl Default for ZmqConfig {
|
|
fn default() -> Self {
|
|
panic!("Dashboard configuration must be loaded from file - no hardcoded defaults allowed")
|
|
}
|
|
}
|
|
|
|
impl Default for HostsConfig {
|
|
fn default() -> Self {
|
|
panic!("Dashboard configuration must be loaded from file - no hardcoded defaults allowed")
|
|
}
|
|
}
|