Browse Source

Return 503 Service Unavailable when admin panel is disabled

Previously the /admin route returned 200 OK with a plain-text message
when ADMIN_TOKEN was not configured, which misled monitoring tools.
Now returns 503 Service Unavailable to correctly signal the service
is not available.

Fixes #7493
pull/7832/head
shuwen.wu 1 month ago
parent
commit
7bef292f90
  1. 4
      src/api/admin.rs

4
src/api/admin.rs

@ -98,8 +98,8 @@ static CAN_BACKUP: LazyLock<bool> = LazyLock::new(|| ACTIVE_DB_TYPE.get().is_som
static CAN_BACKUP: LazyLock<bool> = LazyLock::new(|| false);
#[get("/")]
fn admin_disabled() -> &'static str {
"The admin panel is disabled, please configure the 'ADMIN_TOKEN' variable to enable it"
fn admin_disabled() -> (Status, &'static str) {
(Status::ServiceUnavailable, "The admin panel is disabled, please configure the 'ADMIN_TOKEN' variable to enable it")
}
const COOKIE_NAME: &str = "VW_ADMIN";

Loading…
Cancel
Save