import { saveSettings, isConfigured, allSettings } from "@/lib/settings" export async function GET() { const configured = isConfigured() return Response.json({ configured }) } export async function POST(req: Request) { const body = await req.json() const allowed = [ "API_BASE_URL", "API_KEY", "WEB_PASSWORD", "WEBHOOK_SECRET", ] const toSave: Record = {} for (const key of allowed) { if (body[key] !== undefined) { toSave[key] = String(body[key]) } } saveSettings(toSave) return Response.json({ ok: true, configured: isConfigured() }) }