From f3b1a5ff3eae1bb0f3e5b0e3628177805a6c4dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Sun, 10 Feb 2019 15:26:19 +0100 Subject: [PATCH] Error when admin panel is disabled --- src/api/admin.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/admin.rs b/src/api/admin.rs index 983fa75c..ae1f3dfa 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -16,7 +16,7 @@ use crate::CONFIG; pub fn routes() -> Vec { if CONFIG.admin_token().is_none() { - return Vec::new(); + return routes![admin_disabled]; } routes![ @@ -31,6 +31,11 @@ pub fn routes() -> Vec { ] } +#[get("/")] +fn admin_disabled() -> &'static str { + "The admin panel is disabled, please configure the 'ADMIN_TOKEN' variable to enable it" +} + const COOKIE_NAME: &str = "BWRS_ADMIN"; const ADMIN_PATH: &str = "/admin";