fix: properly support default/fallback in arktype

This commit is contained in:
Aarnav Tale
2025-05-23 16:23:44 -04:00
parent 769674ab07
commit d25e5fd883
3 changed files with 26 additions and 4 deletions
+5
View File
@@ -133,6 +133,11 @@ export default class DockerIntegration extends Integration<T> {
),
});
log.debug(
'config',
'Requesting Docker containers with filters: %s',
qp.toString(),
);
const res = await this.client.request({
method: 'GET',
path: `/v1.30/containers/json?${qp.toString()}`,
+1 -1
View File
@@ -209,7 +209,7 @@ function deepMerge<T>(target: T, source: DeepPartial<T>): T {
for (const key in source) {
const val = source[key];
if (val === undefined) {
if (val === undefined || val === null) {
continue;
}
+20 -3
View File
@@ -56,6 +56,16 @@ const agentConfig = type({
work_dir: 'string = "/var/lib/headplane/agent"',
});
const partialAgentConfig = type({
enabled: stringToBool,
host_name: 'string | undefined',
pre_authkey: 'string | undefined',
cache_ttl: 'number.integer | undefined',
cache_path: 'string | undefined',
executable_path: 'string | undefined',
work_dir: 'string | undefined',
}).partial();
const dockerConfig = type({
enabled: stringToBool,
container_name: 'string = ""',
@@ -63,6 +73,13 @@ const dockerConfig = type({
socket: 'string = "unix:///var/run/docker.sock"',
});
const partialDockerConfig = type({
enabled: stringToBool,
container_name: 'string | undefined',
container_label: 'string | undefined',
socket: 'string | undefined',
}).partial();
const kubernetesConfig = type({
enabled: stringToBool,
pod_name: 'string',
@@ -78,13 +95,13 @@ const integrationConfig = type({
'kubernetes?': kubernetesConfig,
'proc?': procConfig,
'agent?': agentConfig,
}).onDeepUndeclaredKey('reject');
});
const partialIntegrationConfig = type({
'docker?': dockerConfig.partial(),
'docker?': partialDockerConfig,
'kubernetes?': kubernetesConfig.partial(),
'proc?': procConfig.partial(),
'agent?': agentConfig.partial(),
'agent?': partialAgentConfig,
}).partial();
export const headplaneConfig = type({