Ratankumar10/code-execution-engine
0
1// ─── Configuration ────────────────────────────────────────────2// All settings loaded from environment with sensible defaults3// optimized for 1GB Oracle AMD instance4 5module.exports = {6 // Server7 PORT: parseInt(process.env.PORT) || 3000,8 NODE_ENV: process.env.NODE_ENV || "development",9 10 // Execution constraints11 MAX_CONCURRENT: parseInt(process.env.MAX_CONCURRENT) || 2,12 DEFAULT_TIME_LIMIT: parseInt(process.env.DEFAULT_TIME_LIMIT) || 5,13 DEFAULT_MEMORY_LIMIT: parseInt(process.env.DEFAULT_MEMORY_LIMIT) || 256,14 MAX_TIME_LIMIT: parseInt(process.env.MAX_TIME_LIMIT) || 10,15 MAX_MEMORY_LIMIT: parseInt(process.env.MAX_MEMORY_LIMIT) || 512,16 MAX_CODE_SIZE: parseInt(process.env.MAX_CODE_SIZE) || 65536,17 18 // Docker19 SANDBOX_IMAGE: process.env.SANDBOX_IMAGE || "judge-sandbox",20 TEMP_DIR: process.env.TEMP_DIR || "/tmp/judge",21 22 // Rate limiting23 RATE_LIMIT_WINDOW: parseInt(process.env.RATE_LIMIT_WINDOW) || 60000,24 RATE_LIMIT_MAX: parseInt(process.env.RATE_LIMIT_MAX) || 30,25 26 // Supported languages27 LANGUAGES: {28 c: {29 name: "C",30 extension: ".c",31 fileName: "solution.c",32 compiler: "GCC",33 version: "GCC 13.x",34 boilerplate:35 '#include <stdio.h>\n\nint main() {\n printf("Hello, World!\\n");\n return 0;\n}\n',36 },37 cpp: {38 name: "C++",39 extension: ".cpp",40 fileName: "solution.cpp",41 compiler: "G++",42 version: "G++ 13.x (C++17)",43 boilerplate:44 '#include <bits/stdc++.h>\nusing namespace std;\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n cout << "Hello, World!" << endl;\n return 0;\n}\n',45 },46 python: {47 name: "Python 3",48 extension: ".py",49 fileName: "solution.py",50 interpreter: "Python 3",51 version: "Python 3.11.x",52 boilerplate: 'print("Hello, World!")\n',53 },54 },55 56 // Verdict descriptions57 VERDICTS: {58 AC: {59 code: "AC",60 name: "Accepted",61 description: "Output matches expected output",62 },63 WA: {64 code: "WA",65 name: "Wrong Answer",66 description: "Output does not match expected output",67 },68 TLE: {69 code: "TLE",70 name: "Time Limit Exceeded",71 description: "Program exceeded the time limit",72 },73 MLE: {74 code: "MLE",75 name: "Memory Limit Exceeded",76 description: "Program exceeded the memory limit",77 },78 RE: {79 code: "RE",80 name: "Runtime Error",81 description: "Program crashed during execution",82 },83 CE: {84 code: "CE",85 name: "Compilation Error",86 description: "Program failed to compile",87 },88 IE: {89 code: "IE",90 name: "Internal Error",91 description: "Judge system error",92 },93 },94};95 