Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(api): use env var for base path url #34

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<API_BASE_PATH>/command`.

- `GITLAB_SECRET`

This is a user generated secret, so you can put any value.
Expand Down
3 changes: 2 additions & 1 deletion src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -36,7 +37,7 @@ export async function start(): Promise<() => Promise<void>> {
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 () => {
Expand Down
Loading