[control] Design review: Caddy differences per host in fallback_ready, active apply kind, hosts and watch end, capped device end date, CSR fingerprint for signing by hand, crash points exit without SIGABRT
This commit is contained in:
@@ -124,6 +124,41 @@ fn replay(st: &AppState, s: Stored) -> Response {
|
||||
|
||||
// ---------------------------------------------------------------- overview and hosts
|
||||
|
||||
/// What is known to differ on Caddy for these routes (decision Q3: switch allowed, the
|
||||
/// differences listed). Control cannot run the differential suite at runtime; these are the
|
||||
/// suite's known differences (tests/diff, KD-*) applied to the hosts that use the feature.
|
||||
/// Returns (hosts compared, hosts that behave the same, sentences).
|
||||
pub fn fallback_differences(m: &ianitor_core::Model) -> (u32, u32, Vec<String>) {
|
||||
let mut out = Vec::new();
|
||||
let mut matched = 0u32;
|
||||
for h in m.hosts() {
|
||||
let before = out.len();
|
||||
if h.share_links {
|
||||
out.push(format!(
|
||||
"{}: share links do not work; visitors with a link get the normal sign-in.",
|
||||
h.hostname
|
||||
));
|
||||
}
|
||||
if h.auth == ianitor_core::AuthMode::ForwardAuth {
|
||||
out.push(format!(
|
||||
"{}: if Authelia's answer is broken or cut off, Pingora refuses the visit; Caddy goes by its status alone.",
|
||||
h.hostname
|
||||
));
|
||||
}
|
||||
if out.len() == before {
|
||||
matched += 1;
|
||||
}
|
||||
}
|
||||
if !m.hosts().is_empty() {
|
||||
out.push(
|
||||
"Every host: Caddy adds its own Server and Via headers to answers, and a Content-Type when your service sends none."
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
let n = u32::try_from(m.hosts().len()).unwrap_or(u32::MAX);
|
||||
(n, matched, out)
|
||||
}
|
||||
|
||||
/// Everything the main screen shows, in one call. Answers 304 to a matching If-None-Match.
|
||||
#[utoipa::path(get, path = "/api/v1/overview", tag = "overview",
|
||||
responses((status = 200, body = Overview), (status = 304, description = "Unchanged since the ETag"), (status = 401, body = ErrorEnvelope)),
|
||||
@@ -173,6 +208,9 @@ pub async fn overview(
|
||||
state: r.state.clone(),
|
||||
summary: r.summary.clone(),
|
||||
seconds_left: r.watch.as_ref().map(|w| w.ends.saturating_sub(now())),
|
||||
kind: r.kind.clone(),
|
||||
hosts: r.hosts.clone(),
|
||||
watch_ends_at: r.watch.as_ref().map(|w| rfc3339(w.ends)),
|
||||
queued: c.queued_count(),
|
||||
});
|
||||
let site = tree
|
||||
@@ -219,9 +257,19 @@ pub async fn overview(
|
||||
running: es.running,
|
||||
target: es.target,
|
||||
switchable: es.switchable,
|
||||
fallback_ready: Some(FallbackReady {
|
||||
built_at: caddy_built,
|
||||
current: caddy_current,
|
||||
fallback_ready: Some({
|
||||
let (compared, matched, differences) = tree
|
||||
.as_ref()
|
||||
.and_then(|t| t.model().ok())
|
||||
.map(|m| fallback_differences(&m))
|
||||
.unwrap_or_default();
|
||||
FallbackReady {
|
||||
built_at: caddy_built,
|
||||
current: caddy_current,
|
||||
compared,
|
||||
matched,
|
||||
differences,
|
||||
}
|
||||
}),
|
||||
last_error: es.last_error,
|
||||
notes: es.notes,
|
||||
|
||||
Reference in New Issue
Block a user