Use zod to validate config
Closed this issue · 0 comments
forgetso commented
See examples in provider/src/types/captcha.ts
export const DatasetSchema = z.object({
datasetId: z.string().optional(),
captchas: CaptchasSchema,
format: z.nativeEnum(CaptchaTypes),
tree: z.array(z.array(z.string())).optional()
})
and then apply zod parsing within getConfig
to ensure config is valid.
private static getConfig (): ProsopoConfig {
const filePath = Environment.getConfigPath()
return Environment.importCsjOrEsModule(filePath)
}