Skip to content

Commit

Permalink
Merge pull request #41 from J-Hoplin/feature/rapid-api-integration
Browse files Browse the repository at this point in the history
Feat: Integrate Rapid Judge API
  • Loading branch information
J-Hoplin authored Feb 24, 2024
2 parents c25ff08 + e5cf0b3 commit 75b51ef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ADMIN_EMAIL="hoplin.dev@gmail.com"
ADMIN_PW = "admin"
JWT_SECRET="SECRET"
JUDGE_SERVER_ENDPOINT="a"
JUDGE_AUTH_KEY=""
ENV="a" # dev or production
PORT="3000"

Expand Down
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ DATABASE_URL="mysql://root:hoplin1234!@localhost:3306/judge?schema=public"
ADMIN_EMAIL="hoplin.dev@gmail.com"
ADMIN_PW = "admin"
JWT_SECRET="SECRET"
JUDGE_SERVER_ENDPOINT="a"
JUDGE_SERVER_ENDPOINT=""
JUDGE_AUTH_KEY="bb94a17ca2mshd975e936bb4ea0cp1887aejsn53199d6ceb32"
ENV="a" # dev or production
PORT="3000"

Expand Down
2 changes: 1 addition & 1 deletion .test.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ADMIN_PW = "admin"
JWT_SECRET="SECRET"

JUDGE_SERVER_ENDPOINT="test"

JUDGE_AUTH_KEY=""
ENV=""
PORT=""

Expand Down
7 changes: 6 additions & 1 deletion libs/judge0/src/judge0.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ export class Judge0Service {
private instance: AxiosInstance;
constructor() {
const judge0Endpoint = process.env.JUDGE_SERVER_ENDPOINT;
const judge0AuthKey = process.env.JUDGE_AUTH_KEY;
if (!judge0Endpoint) {
throw new Error('Judge Server Endpoint not found');
}
this.instance = axios.create({
baseURL: judge0Endpoint,
baseURL: `https://${judge0Endpoint}`,
headers: {
'X-RapidAPI-Key': judge0AuthKey ?? '',
'X-RapidAPI-Host': judge0Endpoint,
},
});
}

Expand Down

0 comments on commit 75b51ef

Please sign in to comment.