[control] Mark's UI decisions: Remote-Name shown with the proof, [ui] logout_url for Sign out, openssl signing files for the manual intermediate step, engine.not_ready, server sentences for the eight generic codes
This commit is contained in:
@@ -201,6 +201,9 @@ impl Control {
|
||||
if self.engine_cfg().is_none() || self.units.is_none() {
|
||||
return Err(Fail::new(409, "engine.unmanaged", Params::new()));
|
||||
}
|
||||
if target == "caddy" && !self.fallback_buildable() {
|
||||
return Err(Fail::new(409, "engine.not_ready", Params::new()));
|
||||
}
|
||||
if target != "pingora" && target != "caddy" {
|
||||
return Err(Fail::new(
|
||||
422,
|
||||
@@ -385,6 +388,13 @@ impl Control {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Can Caddy's settings be built from the current tree? (Otherwise `engine.not_ready`.)
|
||||
pub fn fallback_buildable(&self) -> bool {
|
||||
self.head_model().ok().is_some_and(|(_, _, m)| {
|
||||
ianitor_core::compile::caddy(&m, &self.cfg.caddy_compile().options()).is_ok()
|
||||
})
|
||||
}
|
||||
|
||||
/// Any reason changes wait now: Caddy serving, or a pause.
|
||||
pub fn effective_pause(&self) -> Option<Reason> {
|
||||
self.engine_pause().or_else(|| self.paused())
|
||||
|
||||
Reference in New Issue
Block a user