From e66f76e881a33aecb984bb42eedf74d20fca10e0 Mon Sep 17 00:00:00 2001 From: Tobias Tiederle Date: Tue, 4 Oct 2022 08:53:46 +0000 Subject: [PATCH] configure landing page using environment variable --- application/controllers/IndexController.php | 7 +++++- doc/20-Advanced-Topics.md | 26 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index dac1789900..539c16ba3e 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -17,8 +17,13 @@ class IndexController extends ActionController public function preDispatch() { if ($this->getRequest()->getActionName() !== 'welcome') { + $landingPage = getenv('ICINGAWEB_LANDING_PAGE'); + if (! $landingPage) { + $landingPage = 'dashboard'; + } + // @TODO(el): Avoid landing page redirects: https://dev.icinga.com/issues/9656 - $this->redirectNow(Url::fromRequest()->setPath('dashboard')); + $this->redirectNow(Url::fromRequest()->setPath($landingPage)); } } diff --git a/doc/20-Advanced-Topics.md b/doc/20-Advanced-Topics.md index fe2deffcd0..6835a6f28c 100644 --- a/doc/20-Advanced-Topics.md +++ b/doc/20-Advanced-Topics.md @@ -9,6 +9,7 @@ This chapter provides details for advanced Icinga Web 2 topics. * [Source installation](20-Advanced-Topics.md#installing-from-source) * [Automated setup](20-Advanced-Topics.md#web-setup-automation) * [Kiosk Mode Configuration](20-Advanced-Topics.md#kiosk-mode) +* [Customizing the Landing Page](20-Advanced-Topics.md#landing-page) ## Global URL Parameters @@ -412,3 +413,28 @@ If you want to show a specific Dashboard you can enforce this onto the kiosk use ``` Replace Remote_Addr with the IP where the kiosk user is accessing the Web to restrict further usage from other IPs. + +## Customizing the Landing Page + +The default landing page of `dashboard` can be customized using the environment variable `ICINGAWEB_LANDING_PAGE`. + +Example on RHEL/CentOS: + +``` +vim /etc/httpd/conf.d/web.icinga.com.conf + + + + ... + + + + ... + + SetEnv ICINGAWEB_LANDING_PAGE "icingadb/services/grid?problems" + + ... + + + +```