diff --git a/.env.test b/.env.test index 9bbe813..23d95ff 100644 --- a/.env.test +++ b/.env.test @@ -1,3 +1,5 @@ + +API_BASE_PATH=/api/v1/homer EMAIL_DOMAINS=my-domain.com,ext.my-domain.com GITLAB_SECRET=GITLAB_SECRET GITLAB_TOKEN=GITLAB_TOKEN diff --git a/README.md b/README.md index 2a99c74..90041b7 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,10 @@ Be sure to have all those installed: Create a `.env` file containing the following variables: +- `API_BASE_PATH` + + This is the base path that will be used to build the API URL to call homer, for example `https://homer.com/command`. + - `GITLAB_SECRET` This is a user generated secret, so you can put any value. diff --git a/src/start.ts b/src/start.ts index ed6f722..29115ef 100644 --- a/src/start.ts +++ b/src/start.ts @@ -10,6 +10,7 @@ import { logger } from '@/core/services/logger'; import { catchAsyncRouteErrors } from '@/core/utils/catchAsyncRouteErrors'; import { waitForNonReadyReleases } from '@/release/commands/create/utils/waitForNonReadyReleases'; import { REQUEST_BODY_SIZE_LIMIT } from './constants'; +import { getEnvVariable } from './core/utils/getEnvVariable'; import { router } from './router'; const PORT = 3000; @@ -36,7 +37,7 @@ export async function start(): Promise<() => Promise> { catchAsyncRouteErrors(stateRequestHandler) ); app.use(securityMiddleware); - app.use('/api/v1/homer', router); + app.use(getEnvVariable('API_BASE_PATH'), router); app.use(errorMiddleware); const server = app.listen(PORT, async () => {