chore: covered edge cases with no config setup 02cd10db
Steve · 2026-02-19 14:11 2 file(s) · +5 −5
src/server.rs +1 −1
36 36
        let auth_endpoints = match std::env::var("SIPP_AUTH_ENDPOINTS") {
37 37
            Ok(val) if val.trim().eq_ignore_ascii_case("none") => HashSet::new(),
38 38
            Ok(val) => val.split(',').map(|s| s.trim().to_lowercase()).collect(),
39 -
            Err(_) => HashSet::new(),
39 +
            Err(_) => ["api_delete", "api_list"].iter().map(|s| s.to_string()).collect(),
40 40
        };
41 41
        ServerConfig { api_key, auth_endpoints }
42 42
    }
src/tui.rs +4 −4
293 293
294 294
    if !std::path::Path::new("sipp.sqlite").exists() {
295 295
        let cfg = config::load_config();
296 -
        if let Some(url) = cfg.remote_url {
297 -
            return (Backend::remote(url.clone(), cfg.api_key), true, Some(url));
298 -
        }
296 +
        let url = cfg.remote_url.unwrap_or_else(|| "http://localhost:3000".to_string());
297 +
        let api_key = api_key.or(cfg.api_key);
298 +
        return (Backend::remote(url.clone(), api_key), true, Some(url));
299 299
    }
300 300
301 -
    (Backend::local(), false, None)
301 +
    (Backend::local(), false, Some("http://localhost:3000".to_string()))
302 302
}
303 303
304 304
pub fn run_auth() -> Result<(), Box<dyn std::error::Error>> {