Files
Deep-Package-Inspection/scripts/trigger-now.js
T
rafif dd4c8f6876 feat(source2): push all latest files - device labeling, help system, proxy docs, database isolation fix
- Added DOKUMENTASI-FILTER-PER-SITE.md (site isolation docs)
- Fixed start-with-env.js to force-load .env.production
- Fixed MONGODB_URI hostname from mongodb-netify to mongodb.prod.proit.id
- Updated .gitignore to exclude sensitive scripts and credential files
- Minor UI and labeling improvements
2026-07-29 14:14:29 +07:00

29 lines
865 B
JavaScript

if (typeof globalThis.crypto === 'undefined') {
globalThis.crypto = require('crypto');
}
const mongoose = require('mongoose');
const path = require('path');
require('dotenv').config({ path: path.join(__dirname, '..', '.env.production') });
const MONGODB_URI = process.env.MONGODB_URI;
const { collectAllAgents } = require('../proxy/collector');
async function run() {
console.log('[Trigger] Connecting to MongoDB...');
await mongoose.connect(MONGODB_URI);
console.log('[Trigger] Connected. Starting collection cycle...');
try {
const res = await collectAllAgents();
console.log('[Trigger] Collection cycle finished successfully:', res);
} catch (err) {
console.error('[Trigger] Collection cycle failed:', err);
} finally {
await mongoose.connection.close();
console.log('[Trigger] MongoDB connection closed.');
}
}
run();