feat: add SCOUT_ENABLED flag to disable scout bot safely
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Has been cancelled
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Has been cancelled
This commit is contained in:
@@ -10,6 +10,7 @@ const SCOUT_API_KEY = process.env.SCOUT_API_KEY;
|
||||
const SCOUT_AGENT_ID = process.env.SCOUT_AGENT_ID || "scout_official_1";
|
||||
const SCOUT_CRON_EXPRESSION = process.env.SCOUT_CRON_EXPRESSION || "*/3 * * * *";
|
||||
const SCOUT_ISSUE_LABELS_RAW = process.env.SCOUT_ISSUE_LABELS || process.env.SCOUT_ISSUE_LABEL || "";
|
||||
const SCOUT_ENABLED = (process.env.SCOUT_ENABLED || "true").toLowerCase() !== "false";
|
||||
const SCOUT_TARGET_REPOS_RAW =
|
||||
process.env.SCOUT_TARGET_REPOS ||
|
||||
"open-webui/open-webui,microsoft/vscode,vercel/next.js,langchain-ai/langgraph,facebook/react,microsoft/TypeScript,openai/openai-cookbook,astral-sh/ruff,sequelize/sequelize,pnpm/pnpm,prisma/prisma";
|
||||
@@ -334,6 +335,11 @@ async function scanRepositories() {
|
||||
}
|
||||
|
||||
async function bootstrap() {
|
||||
if (!SCOUT_ENABLED) {
|
||||
console.log("SCOUT_ENABLED is false. Scout bot is disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Delay first scan a bit so main web API is ready after startup.
|
||||
await wait(10);
|
||||
await scanRepositories();
|
||||
@@ -341,10 +347,14 @@ async function bootstrap() {
|
||||
|
||||
bootstrap();
|
||||
|
||||
// Default: every 1 minute for phase-1 high-velocity inbound traffic
|
||||
cron.schedule(SCOUT_CRON_EXPRESSION, () => {
|
||||
console.log(`Running scheduled GitHub scan (${SCOUT_CRON_EXPRESSION})...`);
|
||||
scanRepositories();
|
||||
});
|
||||
if (SCOUT_ENABLED) {
|
||||
// Default: every 1 minute for phase-1 high-velocity inbound traffic
|
||||
cron.schedule(SCOUT_CRON_EXPRESSION, () => {
|
||||
console.log(`Running scheduled GitHub scan (${SCOUT_CRON_EXPRESSION})...`);
|
||||
scanRepositories();
|
||||
});
|
||||
} else {
|
||||
console.log("Cron schedule is disabled because SCOUT_ENABLED=false.");
|
||||
}
|
||||
|
||||
console.log("VibeWork Scout Bot started and scheduled.");
|
||||
|
||||
Reference in New Issue
Block a user