refactor: manage monitor via gateway hooks

This commit is contained in:
2026-04-04 00:44:33 +00:00
parent 3b0ea0ad12
commit 038862ef8c
36 changed files with 244 additions and 1932 deletions

35
plugin/core/config.ts Normal file
View File

@@ -0,0 +1,35 @@
import { hostname } from 'os';
export interface HarborForgePluginConfig {
enabled?: boolean;
backendUrl?: string;
identifier?: string;
apiKey?: string;
monitor_port?: number;
reportIntervalSec?: number;
httpFallbackIntervalSec?: number;
logLevel?: 'debug' | 'info' | 'warn' | 'error';
calendarEnabled?: boolean;
calendarHeartbeatIntervalSec?: number;
calendarApiKey?: string;
managedMonitor?: string;
}
interface PluginApiLike {
pluginConfig?: Record<string, unknown>;
}
export function getPluginConfig(api: PluginApiLike): HarborForgePluginConfig {
const cfg = (api.pluginConfig || {}) as HarborForgePluginConfig;
return {
enabled: true,
backendUrl: 'https://monitor.hangman-lab.top',
identifier: hostname(),
reportIntervalSec: 30,
httpFallbackIntervalSec: 60,
logLevel: 'info',
calendarEnabled: true,
calendarHeartbeatIntervalSec: 60,
...cfg,
};
}