36 lines
921 B
TypeScript
36 lines
921 B
TypeScript
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,
|
|
};
|
|
}
|