From 67b27aec2bd5712433eaf5c03076e634ae14453c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <git@minelli.swiss> Date: Fri, 11 Oct 2024 23:42:36 +0200 Subject: [PATCH] Routes => Add a route that provide to client the configuration --- ExpressAPI/src/routes/BaseRoutes.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ExpressAPI/src/routes/BaseRoutes.ts b/ExpressAPI/src/routes/BaseRoutes.ts index e26e11a..f4a74de 100644 --- a/ExpressAPI/src/routes/BaseRoutes.ts +++ b/ExpressAPI/src/routes/BaseRoutes.ts @@ -2,12 +2,15 @@ import { Express } from 'express-serve-static-core'; import express, { RequestHandler } from 'express'; import { StatusCodes } from 'http-status-codes'; import RoutesManager from '../express/RoutesManager.js'; +import Config from '../config/Config'; class BaseRoutes implements RoutesManager { registerOnBackend(backend: Express) { backend.get('/', this.homepage.bind(this) as RequestHandler); backend.get('/health_check', this.healthCheck.bind(this) as RequestHandler); + + backend.get('/clients_config', this.clientsConfig.bind(this) as RequestHandler); } private async homepage(req: express.Request, res: express.Response) { @@ -17,6 +20,15 @@ class BaseRoutes implements RoutesManager { private async healthCheck(req: express.Request, res: express.Response) { return req.session.sendResponse(res, StatusCodes.OK); } + + private async clientsConfig(req: express.Request, res: express.Response) { + return req.session.sendResponse(res, StatusCodes.OK, { + gitlabUrl : Config.gitlab.url, + gitlabAccountId : Config.gitlab.account.id, + gitlabAccountUsername: Config.gitlab.account.username, + loginGitlabClientId : Config.login.gitlab.client.id + }); + } } -- GitLab