Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cockpit/ui/src-tauri/src/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ fn telltale_base() -> Option<String> {
// No default. An unset base URL means "Intake is not configured on this
// machine", which the adapter must be able to tell apart from "configured but
// unreachable" — the second greys a lane, the first should not invent one.
std::env::var("TELLTALE_BASE_URL").ok().filter(|s| !s.trim().is_empty())
std::env::var("TELLTALE_BASE_URL")
.ok()
.filter(|s| !s.trim().is_empty())
}

/// `GET {TELLTALE_BASE_URL}/v1/issues` → `{ issues, errors }` (spec §6.3), passed
Expand All @@ -123,8 +125,8 @@ fn telltale_base() -> Option<String> {
#[tauri::command]
pub async fn feedback_issues() -> Result<Value, String> {
let base = telltale_base().ok_or_else(|| "TELLTALE_BASE_URL is not set".to_string())?;
let token = std::env::var("TELLTALE_TOKEN")
.map_err(|_| "TELLTALE_TOKEN is not set".to_string())?;
let token =
std::env::var("TELLTALE_TOKEN").map_err(|_| "TELLTALE_TOKEN is not set".to_string())?;

let url = format!("{}/v1/issues", base.trim_end_matches('/'));
let resp = reqwest::Client::new()
Expand Down
11 changes: 8 additions & 3 deletions crates/fleetd/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use axum::{
routing::{get, post},
Json, Router,
};
use tower_http::cors::{AllowOrigin, CorsLayer};
use fleet_core::{Command, Event, GateConfig, Phase, Tier};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
Expand All @@ -44,6 +43,7 @@ use std::sync::{
};
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
use tokio::sync::{broadcast, mpsc, Semaphore};
use tower_http::cors::{AllowOrigin, CorsLayer};

fn now_ms() -> i64 {
SystemTime::now()
Expand Down Expand Up @@ -2319,7 +2319,10 @@ mod tests {
.get(header::ACCESS_CONTROL_ALLOW_METHODS)
.map(|v| v.to_str().unwrap().to_string())
.unwrap_or_default();
assert!(methods.contains("POST"), "POST must be allowed, got {methods:?}");
assert!(
methods.contains("POST"),
"POST must be allowed, got {methods:?}"
);
}

#[tokio::test]
Expand Down Expand Up @@ -2359,7 +2362,9 @@ mod tests {
.unwrap();

assert!(
res.headers().get(header::ACCESS_CONTROL_ALLOW_ORIGIN).is_none(),
res.headers()
.get(header::ACCESS_CONTROL_ALLOW_ORIGIN)
.is_none(),
"an unlisted origin must not be granted access",
);
}
Expand Down
Loading