//! Runtime configuration. Nothing machine- or account-specific is compiled in.
//! File: $UU_CONFIG, else $XDG_CONFIG_HOME/uuremote/config.json, else ~/.config/uuremote/config.json.
//! Environment variables override file values. Keep the file private (chmod 600).
use std::path::PathBuf;
use std::sync::OnceLock;
pub fn path() -> PathBuf {
if let Some(p) = std::env::var_os("UU_CONFIG") { return PathBuf::from(p); }
let base = std::env::var_os("XDG_CONFIG_HOME").map(PathBuf::from)
.or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".config")))
.unwrap_or_else(|| PathBuf::from("."));
base.join("uuremote/config.json")
}
/// Re-reads the config file (used after `login` rewrites it while the server runs).
pub fn read_fresh() -> Result