From d2925fbd49d9704435f6475ff7ccd530e17974cb Mon Sep 17 00:00:00 2001 From: Matthieu Lamalle Date: Mon, 11 Dec 2023 13:57:15 +0100 Subject: [PATCH 1/3] Ajout health path --- config/packages/security.yaml | 1 + src/Controller/MainController.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/config/packages/security.yaml b/config/packages/security.yaml index a07d73e..dd76dec 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -37,6 +37,7 @@ security: access_control: - { path: ^/login, roles: PUBLIC_ACCESS } - { path: ^/connect, roles: ROLE_USER } + - { path: ^/health, roles: PUBLIC_ACCESS } # - { path: ^/connect, roles: [IS_AUTHENTICATED_FULLY, ROLE_USER] } when@test: diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 9dc1ff3..3532e99 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -7,6 +7,7 @@ use App\Hydra\Client; use App\Hydra\HydraService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Routing\Annotation\Route; @@ -30,6 +31,12 @@ class MainController extends AbstractController return $this->hydra->handleLoginRequest($request); } + #[Route('/health', name: 'health')] + public function health(Request $request) + { + return new Response('healthy', 200); + } + #[Route('/connect/login-accept', name: 'app_login_accept')] public function loginAccept(Request $request) { From 47917abafb29b65f92e7dba33ce4d189a1ab0e9a Mon Sep 17 00:00:00 2001 From: Matthieu Lamalle Date: Mon, 11 Dec 2023 14:07:40 +0100 Subject: [PATCH 2/3] typo --- src/Controller/MainController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 3532e99..7799db4 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -7,8 +7,8 @@ use App\Hydra\Client; use App\Hydra\HydraService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Routing\Annotation\Route; From df59f29fc2bc2a579a3cfb811a13311991f29e02 Mon Sep 17 00:00:00 2001 From: Matthieu Lamalle Date: Mon, 11 Dec 2023 14:13:35 +0100 Subject: [PATCH 3/3] ajout commentaire --- src/Controller/MainController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 7799db4..d1f96be 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -30,7 +30,9 @@ class MainController extends AbstractController { return $this->hydra->handleLoginRequest($request); } - + /* + * Route de Healthcheck (notament pour kubernetes) + */ #[Route('/health', name: 'health')] public function health(Request $request) {