diff --git a/.docker.env b/.docker.env index 912c04d..9e1e065 100644 --- a/.docker.env +++ b/.docker.env @@ -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" diff --git a/.env b/.env index f6bf655..31939f7 100644 --- a/.env +++ b/.env @@ -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" diff --git a/.test.env b/.test.env index b70fe58..f7f32f8 100644 --- a/.test.env +++ b/.test.env @@ -12,7 +12,7 @@ ADMIN_PW = "admin" JWT_SECRET="SECRET" JUDGE_SERVER_ENDPOINT="test" - +JUDGE_AUTH_KEY="" ENV="" PORT="" diff --git a/libs/judge0/src/judge0.service.ts b/libs/judge0/src/judge0.service.ts index 7c6e958..be71b53 100644 --- a/libs/judge0/src/judge0.service.ts +++ b/libs/judge0/src/judge0.service.ts @@ -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, + }, }); }