mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-10 14:45:16 -05:00
* feat(deployed-form): added deployed form input * styling consolidation, finishing touches on form * updated docs * remove unused files with knip * added more form fields * consolidated more test utils * remove unused/unneeded zustand stores, refactored stores for consistency * improvement(files): uncolorized plan name * feat(emcn): button-group * feat(emcn): tag input, tooltip shortcut * improvement(emcn): modal padding, api, chat, form * fix: deleted migrations * feat(form): added migrations * fix(emcn): tag input * fix: failing tests on build * add suplementary hover and fix bg color in date picker * fix: build errors --------- Co-authored-by: Emir Karabeg <emirkarabeg@berkeley.edu>
22 lines
550 B
TypeScript
22 lines
550 B
TypeScript
import type { NextRequest } from 'next/server'
|
|
import { env } from '@/lib/core/config/env'
|
|
|
|
export function checkInternalApiKey(req: NextRequest) {
|
|
const apiKey = req.headers.get('x-api-key')
|
|
const expectedApiKey = env.INTERNAL_API_SECRET
|
|
|
|
if (!expectedApiKey) {
|
|
return { success: false, error: 'Internal API key not configured' }
|
|
}
|
|
|
|
if (!apiKey) {
|
|
return { success: false, error: 'API key required' }
|
|
}
|
|
|
|
if (apiKey !== expectedApiKey) {
|
|
return { success: false, error: 'Invalid API key' }
|
|
}
|
|
|
|
return { success: true }
|
|
}
|