mirror of
https://github.com/tale/headplane.git
synced 2026-08-13 15:07:24 +00:00
feat: use a new ws implementation thats encapsulated
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
import type { HostInfo } from '~/types';
|
||||
import { TimedCache } from '~server/ws/cache';
|
||||
import { hp_agentRequest, hp_getAgentCache } from '~server/ws/data';
|
||||
import { hp_getConfig } from './loader';
|
||||
import { HeadplaneConfig } from './parser';
|
||||
import type { HeadplaneConfig } from './parser';
|
||||
|
||||
export interface AppContext {
|
||||
context: HeadplaneConfig;
|
||||
agentData?: TimedCache<HostInfo>;
|
||||
hp_agentRequest: typeof hp_agentRequest;
|
||||
}
|
||||
|
||||
export default function appContext() {
|
||||
return {
|
||||
context: hp_getConfig(),
|
||||
agentData: hp_getAgentCache(),
|
||||
hp_agentRequest,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,6 +8,17 @@ const serverConfig = type({
|
||||
port: type('string | number.integer').pipe((v) => Number(v)),
|
||||
cookie_secret: '32 <= string <= 32',
|
||||
cookie_secure: stringToBool,
|
||||
agent: type({
|
||||
authkey: 'string',
|
||||
ttl: 'number.integer = 180000', // Default to 3 minutes
|
||||
cache_path: 'string = "/var/lib/headplane/agent_cache.json"',
|
||||
})
|
||||
.onDeepUndeclaredKey('reject')
|
||||
.default(() => ({
|
||||
authkey: '',
|
||||
ttl: 180000,
|
||||
cache_path: '/var/lib/headplane/agent_cache.json',
|
||||
})),
|
||||
});
|
||||
|
||||
const oidcConfig = type({
|
||||
|
||||
Reference in New Issue
Block a user