send default spec in policy worker

This commit is contained in:
Siddharth Singh 2025-05-07 09:56:20 +05:30
parent e947e6d3f4
commit b613334312
No known key found for this signature in database

View file

@ -1,5 +1,5 @@
import { type AppController } from '@/app.ts';
import { createPolicyEvent } from '@/utils/policies/mod.ts';
import { createPolicyEvent, DEFAULT_POLICY_SPEC } from '@/utils/policies/mod.ts';
import { policyRegistry } from '@/utils/policies/mod.ts';
import { z } from 'zod';
@ -27,7 +27,7 @@ export const adminCurrentPolicyController: AppController = async (c) => {
}]).then((events) => events[0]);
if (current) return c.json({ spec: JSON.parse(current.content) });
return c.json({ spec: { policies: [] } });
return c.json({ spec: { policies: DEFAULT_POLICY_SPEC } });
};
const PolicySpecSchema = z.object({