judge: add override config

This commit is contained in:
undefined committed 2026-03-30 18:54:31 +08:00
1 parent e66a6cdffb
commit 403a762da1
2 files changed
+14 -8

No files matched your search

+7 -7
View File
@@ -1,24 +1,24 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "3.5.0-beta.14",
"version": "3.5.0-beta.15",
"main": "./src/index.ts",
"author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git",
"dependencies": {
"@hydrooj/common": "workspace:^",
"@hydrooj/utils": "workspace:^",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.212.0",
"@opentelemetry/sdk-node": "^0.212.0",
"@zip.js/zip.js": "^2.8.21",
"@opentelemetry/api": "^1.9.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.214.0",
"@opentelemetry/sdk-node": "^0.214.0",
"@zip.js/zip.js": "^2.8.23",
"cac": "^6.7.14",
"p-queue": "^9.1.0",
"schemastery": "^3.17.2",
"schemastery": "^3.18.0",
"semver": "^7.7.4",
"shell-quote": "^1.8.3",
"superagent": "^10.3.0",
"ws": "^8.19.0"
"ws": "^8.20.0"
},
"preferUnplugged": true,
"license": "AGPL-3.0-or-later",
+7 -1
View File
@@ -68,9 +68,15 @@ let config = global.Hydro
}
const configFilePath = (process.env.CONFIG_FILE || argv.options.config)
? path.resolve(process.env.CONFIG_FILE || argv.options.config)
: fs.existsSync(oldPath) ? oldPath : newPath;
: fs.existsSync(newPath) ? newPath : oldPath;
const configFile = fs.readFileSync(configFilePath, 'utf-8');
Object.assign(base, yaml.load(configFile) as any);
if (process.env.OVERRIDE_CONFIG) {
if (fs.existsSync(process.env.OVERRIDE_CONFIG)) {
const overrideConfigFile = fs.readFileSync(process.env.OVERRIDE_CONFIG, 'utf-8');
Object.assign(base, yaml.load(overrideConfigFile) as any);
} else console.warn('Override config file not found');
}
const cfg = JudgeSettings(base);
return JudgeSettings(cfg);
})();