Files
khb_microservices/packages/data_collector/src/settings.ts
2026-10-15 20:59:43 +03:00

25 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { z } from "zod";
export const httpSchema = z.object({ host: z.string().default("127.0.0.1"), port: z.number(), token: z.string().min(1) });
export const dataCollectorSchema = z.object({
http: httpSchema,
sources: z.array(z.string()).default(["jobtread"]),
mirror: z.object({ maxSnapshotAgeMinutes: z.number().default(90) }).default({}),
retention: z
.object({
hourlyKeepHours: z.number().optional(),
dailyKeepDays: z.number().optional(),
dbSizeLimitGb: z.number().optional(),
reducedDaysSteps: z.array(z.number()).optional(),
failedKeepDays: z.number().optional(),
failedMaxPerDay: z.number().optional(),
})
.default({}),
events: z.object({ backfillDays: z.number().default(90) }).default({}),
/** Сообщения людей в проектных каналах Slack (активность). Без токена загрузка пропускается. Токен бота - тот же, что у khbuild_assistant_prep. */
slack: z.object({ botToken: z.string().min(1), backfillDays: z.number().default(90) }).optional(),
holidays: z.object({ country: z.string().default("US"), state: z.string().default("FL"), yearsAhead: z.number().default(2) }).default({}),
});
export type DataCollectorSettings = z.infer<typeof dataCollectorSchema>;