CoolFace
Apppublic

Ratan1729/code-execution

sourceHugging Faceupdated 8mo agoView on Hugging Face
1likes
config.js99 linesDownload Raw Back to src
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 mode: 'docker' (default) or 'process' (for HF Spaces)11  EXECUTION_MODE: process.env.EXECUTION_MODE || "docker",12 13  // Execution constraints14  MAX_CONCURRENT: parseInt(process.env.MAX_CONCURRENT) || 2,15  DEFAULT_TIME_LIMIT: parseInt(process.env.DEFAULT_TIME_LIMIT) || 5,16  DEFAULT_MEMORY_LIMIT: parseInt(process.env.DEFAULT_MEMORY_LIMIT) || 256,17  MAX_TIME_LIMIT: parseInt(process.env.MAX_TIME_LIMIT) || 10,18  MAX_MEMORY_LIMIT: parseInt(process.env.MAX_MEMORY_LIMIT) || 512,19  MAX_CODE_SIZE: parseInt(process.env.MAX_CODE_SIZE) || 65536,20  MAX_INPUT_SIZE: parseInt(process.env.MAX_INPUT_SIZE) || 5242880, // 5MB for test case inputs21 22  // Docker23  SANDBOX_IMAGE: process.env.SANDBOX_IMAGE || "judge-sandbox",24  TEMP_DIR: process.env.TEMP_DIR || "/tmp/judge",25 26  // Rate limiting27  RATE_LIMIT_WINDOW: parseInt(process.env.RATE_LIMIT_WINDOW) || 60000,28  RATE_LIMIT_MAX: parseInt(process.env.RATE_LIMIT_MAX) || 30,29 30  // Supported languages31  LANGUAGES: {32    c: {33      name: "C",34      extension: ".c",35      fileName: "solution.c",36      compiler: "GCC",37      version: "GCC 13.x",38      boilerplate:39        '#include <stdio.h>\n\nint main() {\n    printf("Hello, World!\\n");\n    return 0;\n}\n',40    },41    cpp: {42      name: "C++",43      extension: ".cpp",44      fileName: "solution.cpp",45      compiler: "G++",46      version: "G++ 13.x (C++17)",47      boilerplate:48        '#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',49    },50    python: {51      name: "Python 3",52      extension: ".py",53      fileName: "solution.py",54      interpreter: "Python 3",55      version: "Python 3.11.x",56      boilerplate: 'print("Hello, World!")\n',57    },58  },59 60  // Verdict descriptions61  VERDICTS: {62    AC: {63      code: "AC",64      name: "Accepted",65      description: "Output matches expected output",66    },67    WA: {68      code: "WA",69      name: "Wrong Answer",70      description: "Output does not match expected output",71    },72    TLE: {73      code: "TLE",74      name: "Time Limit Exceeded",75      description: "Program exceeded the time limit",76    },77    MLE: {78      code: "MLE",79      name: "Memory Limit Exceeded",80      description: "Program exceeded the memory limit",81    },82    RE: {83      code: "RE",84      name: "Runtime Error",85      description: "Program crashed during execution",86    },87    CE: {88      code: "CE",89      name: "Compilation Error",90      description: "Program failed to compile",91    },92    IE: {93      code: "IE",94      name: "Internal Error",95      description: "Judge system error",96    },97  },98};99