commit f3b1a5ff3eae1bb0f3e5b0e3628177805a6c4dfb parent 330e90a6acc6fae023bbe3969f144424a3f92b21 Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com> Date: Sun, 10 Feb 2019 15:26:19 +0100 Error when admin panel is disabled Diffstat:
M | src/api/admin.rs | | | 7 | ++++++- |
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/api/admin.rs b/src/api/admin.rs @@ -16,7 +16,7 @@ use crate::CONFIG; pub fn routes() -> Vec<Route> { if CONFIG.admin_token().is_none() { - return Vec::new(); + return routes![admin_disabled]; } routes![ @@ -31,6 +31,11 @@ pub fn routes() -> Vec<Route> { ] } +#[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";