Skip to content

Commit

Permalink
Merge pull request #188 from CS3219-AY2425S1/184-nginx-for-collab-ser…
Browse files Browse the repository at this point in the history
…vice

Bug Fix for CD
  • Loading branch information
Daviancold authored Nov 3, 2024
2 parents 58fc6eb + 5eaf196 commit 59ec090
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { SubmissionRequestDto, SubmissionResponseDto } from '@repo/submission-ty
import { CollabDto } from '../types/CollabDto'
import { createSession, getSessionById } from '../models/collab.repository'
import judgeZero from '../services/judgezero.service'
import config from '../common/config.util'

export async function createSessionRequest(request: ITypedBodyRequest<CollabDto>, response: Response): Promise<void> {
const collabDto = CollabDto.fromRequest(request)
Expand Down Expand Up @@ -76,7 +75,7 @@ export async function submitCode(request: ITypedBodyRequest<SubmissionRequestDto
return
}

const res = await judgeZero.post(config.JUDGE_ZERO_SUBMIT_CONFIG, request.body)
const res = await judgeZero.post('/submissions?base64_encoded=false&wait=true', request.body)

if (!res) {
response.status(400).json('Failed to submit code. Please try again.').send()
Expand Down
11 changes: 2 additions & 9 deletions backend/collaboration-service/src/types/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ export class Config {
@IsUrl({ require_tld: false })
JUDGE_ZERO_URL: string

@IsString()
@IsNotEmpty()
JUDGE_ZERO_SUBMIT_CONFIG: string

constructor(
NODE_ENV: string,
PORT: string,
Expand All @@ -39,8 +35,7 @@ export class Config {
USER_SERVICE_URL: string,
QUESTION_SERVICE_URL: string,
MATCHING_SERVICE_URL: string,
JUDGE_ZERO_URL: string,
JUDGE_ZERO_SUBMIT_CONFIG: string
JUDGE_ZERO_URL: string
) {
this.NODE_ENV = NODE_ENV ?? 'development'
this.PORT = PORT ?? '3006'
Expand All @@ -50,7 +45,6 @@ export class Config {
this.QUESTION_SERVICE_URL = QUESTION_SERVICE_URL
this.MATCHING_SERVICE_URL = MATCHING_SERVICE_URL
this.JUDGE_ZERO_URL = JUDGE_ZERO_URL
this.JUDGE_ZERO_SUBMIT_CONFIG = JUDGE_ZERO_SUBMIT_CONFIG
}

static fromEnv(env: { [key: string]: string | undefined }): Config {
Expand All @@ -62,8 +56,7 @@ export class Config {
env.USER_SERVICE_URL!,
env.QUESTION_SERVICE_URL!,
env.MATCHING_SERVICE_URL!,
env.JUDGE_ZERO_URL!,
env.JUDGE_ZERO_SUBMIT_CONFIG!
env.JUDGE_ZERO_URL!
)
}

Expand Down
1 change: 0 additions & 1 deletion docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ services:
- QUESTION_SERVICE_URL=http://question-service:3004
- MATCHING_SERVICE_URL=http://matching-service:3006
- JUDGE_ZERO_URL=http://judgezero-server:2358
- JUDGE_ZERO_SUBMIT_CONFIG=${JUDGE_ZERO_SUBMIT_CONFIG}
restart: always
networks:
- backend-network
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ services:
- QUESTION_SERVICE_URL=http://question-service:3004
- MATCHING_SERVICE_URL=http://matching-service:3006
- JUDGE_ZERO_URL=http://judgezero-server:2358
- JUDGE_ZERO_SUBMIT_CONFIG=${JUDGE_ZERO_SUBMIT_CONFIG}
restart: always
networks:
- backend-network
Expand Down

0 comments on commit 59ec090

Please sign in to comment.