Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LironEr committed Feb 8, 2025
1 parent 9620cf8 commit 0cf3ad0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 27 deletions.
26 changes: 13 additions & 13 deletions apps/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

### Environment variables

| Name | Description | Default |
| ----------------------- | ----------- | ------------------- |
| MONGO_URL | | `-` |
| MONGO_DB_NAME | | `-` |
| MONGO_DB_USER | | `-` |
| MONGO_DB_PASSWORD | | `-` |
| HTTP_SCHEMA | | `https` |
| PORT | | `8080` |
| ROOT_DOMAIN | | `bundlemon.dev` |
| APP_DOMAIN | | `app.bundlemon.dev` |
| SECRET_SESSION_KEY | | Auto generated |
| SHOULD_SERVE_WEBSITE | | `true` |
| MAX_SESSION_AGE_SECONDS | | `21600` (6 hours) |
| Name | Description | Default |
| ----------------------- | ----------- | --------------------- |
| MONGO_URL | | `-` |
| MONGO_DB_NAME | | `-` |
| MONGO_DB_USER | | `-` |
| MONGO_DB_PASSWORD | | `-` |
| HTTP_SCHEMA | | `https` |
| PORT | | `8080` |
| ROOT_DOMAIN | | `bundlemon.dev` |
| APP_DOMAIN | | same as `ROOT_DOMAIN` |
| SECRET_SESSION_KEY | | Auto generated |
| SHOULD_SERVE_WEBSITE | | `true` |
| MAX_SESSION_AGE_SECONDS | | `21600` (6 hours) |

### GitHub App environment variables

Expand Down
2 changes: 1 addition & 1 deletion apps/service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async function init({ isServerless }: InitParams) {

app.register(cors, {
credentials: true,
origin: '*',
origin: true,
} as FastifyCorsOptions);

const cookieParseOptions: FastifyCookieOptions['parseOptions'] = {
Expand Down
2 changes: 1 addition & 1 deletion apps/service/src/framework/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const httpSchema = getOptionalString('HTTP_SCHEMA') || 'https';
export const host = getOptionalString('HOST') || '0.0.0.0';
export const port = getOptionalIntPositive('PORT') || 8080;
export const rootDomain = getOptionalString('ROOT_DOMAIN') || 'bundlemon.dev';
export const appDomain = getOptionalString('APP_DOMAIN') || 'app.bundlemon.dev';
export const appDomain = getOptionalString('APP_DOMAIN') || rootDomain;
export const secretSessionKey = getOptionalString('SECRET_SESSION_KEY') || generateSecretKey();
export const isTestEnv = getOptionalBoolean('IS_TEST_ENV') ?? false;
export const shouldServeWebsite = getOptionalBoolean('SHOULD_SERVE_WEBSITE') ?? false;
Expand Down
20 changes: 8 additions & 12 deletions apps/website/src/services/bundlemonService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,12 @@ const baseFetch = async <R>(input: FetchParams[0], init: FetchParams[1], errorMs
};

export const createProject = async () => {
return await baseFetch<CreateProjectResponse>(
'/projects',
{ method: 'POST', body: '{}' },
'Failed to create project'
);
return await baseFetch<CreateProjectResponse>('projects', { method: 'POST', body: '{}' }, 'Failed to create project');
};

export const getReport = async (projectId: string, commitRecordId: string): Promise<Report> => {
const res = await baseFetch<BaseCommitRecordResponse>(
`/projects/${projectId}/commit-records/${commitRecordId}/base`,
`projects/${projectId}/commit-records/${commitRecordId}/base`,
{
method: 'GET',
},
Expand All @@ -62,7 +58,7 @@ export interface GetCommitRecordsQuery {

export const getCommitRecords = async (projectId: string, query: GetCommitRecordsQuery): Promise<CommitRecord[]> => {
const res = await baseFetch<CommitRecord[]>(
`/projects/${projectId}/commit-records?${new URLSearchParams(removeEmptyValuesFromObject(query)).toString()}`,
`projects/${projectId}/commit-records?${new URLSearchParams(removeEmptyValuesFromObject(query)).toString()}`,
{
method: 'GET',
},
Expand All @@ -74,7 +70,7 @@ export const getCommitRecords = async (projectId: string, query: GetCommitRecord

export const getSubprojects = async (projectId: string): Promise<string[]> => {
const res = await baseFetch<string[]>(
`/projects/${projectId}/subprojects`,
`projects/${projectId}/subprojects`,
{
method: 'GET',
},
Expand All @@ -86,18 +82,18 @@ export const getSubprojects = async (projectId: string): Promise<string[]> => {

export const login = async (code: string) => {
return await baseFetch(
'/auth/login',
'auth/login',
{ method: 'POST', body: JSON.stringify({ provider: 'github', code }), credentials: 'include' },
'Failed to login'
);
};

export const logout = async () => {
return await baseFetch('/auth/logout', { method: 'POST', body: '{}', credentials: 'include' }, 'Failed to logout');
return await baseFetch('auth/logout', { method: 'POST', body: '{}', credentials: 'include' }, 'Failed to logout');
};

export const getMe = async () => {
return await baseFetch('/users/me', { method: 'GET', credentials: 'include' }, 'Failed to get user');
return await baseFetch('users/me', { method: 'GET', credentials: 'include' }, 'Failed to get user');
};

export const reviewCommitRecord = async (
Expand All @@ -107,7 +103,7 @@ export const reviewCommitRecord = async (
comment: string
): Promise<Report> => {
const res = await baseFetch<BaseCommitRecordResponse>(
`/projects/${projectId}/commit-records/${commitRecordId}/reviews`,
`projects/${projectId}/commit-records/${commitRecordId}/reviews`,
{ method: 'POST', body: JSON.stringify({ resolution, comment }), credentials: 'include' },
'Failed to review'
);
Expand Down

0 comments on commit 0cf3ad0

Please sign in to comment.