mirror of
https://github.com/tale/headplane.git
synced 2026-08-12 06:46:51 +00:00
feat: reimplement integrations
This commit is contained in:
@@ -17,6 +17,8 @@ declare global {
|
||||
config_path?: string;
|
||||
config_strict?: boolean;
|
||||
};
|
||||
|
||||
let __integration_context: HeadplaneConfig['integration'];
|
||||
}
|
||||
|
||||
const envBool = type('string | undefined').pipe((v) => {
|
||||
@@ -131,6 +133,9 @@ export async function hp_loadConfig() {
|
||||
config_strict: config.headscale.config_strict,
|
||||
};
|
||||
|
||||
// @ts-expect-error: If we remove globalThis we get a runtime error
|
||||
globalThis.__integration_context = config.integration;
|
||||
|
||||
runtimeConfig = config;
|
||||
runtimeLock.release();
|
||||
}
|
||||
|
||||
@@ -29,17 +29,46 @@ const headscaleConfig = type({
|
||||
config_strict: stringToBool,
|
||||
}).onDeepUndeclaredKey('reject');
|
||||
|
||||
const dockerConfig = type({
|
||||
enabled: stringToBool,
|
||||
container_name: 'string',
|
||||
socket: 'string = "unix:///var/run/docker.sock"',
|
||||
});
|
||||
|
||||
const kubernetesConfig = type({
|
||||
enabled: stringToBool,
|
||||
validate_manifest: stringToBool,
|
||||
});
|
||||
|
||||
const procConfig = type({
|
||||
enabled: stringToBool,
|
||||
});
|
||||
|
||||
const integrationConfig = type({
|
||||
'docker?': dockerConfig,
|
||||
'kubernetes?': kubernetesConfig,
|
||||
'proc?': procConfig,
|
||||
}).onDeepUndeclaredKey('reject');
|
||||
|
||||
const headplaneConfig = type({
|
||||
debug: stringToBool,
|
||||
server: serverConfig,
|
||||
'oidc?': oidcConfig,
|
||||
'integration?': integrationConfig,
|
||||
headscale: headscaleConfig,
|
||||
}).onDeepUndeclaredKey('reject');
|
||||
|
||||
const partialIntegrationConfig = type({
|
||||
'docker?': dockerConfig.partial(),
|
||||
'kubernetes?': kubernetesConfig.partial(),
|
||||
'proc?': procConfig.partial(),
|
||||
}).partial();
|
||||
|
||||
const partialHeadplaneConfig = type({
|
||||
debug: stringToBool,
|
||||
server: serverConfig.partial(),
|
||||
'oidc?': oidcConfig.partial(),
|
||||
'integration?': partialIntegrationConfig,
|
||||
headscale: headscaleConfig.partial(),
|
||||
}).partial();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user