Add production environment guards to Keystatic routes
Implemented production environment guards in Keystatic routes to prevent access to certain functions in production mode. Updated 'layout.tsx.hbs' to redirect to home if the environment is production, and modified 'keystatic-route-handler.ts' to return 404 status code if attempting to utilize route handlers while in production.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
import KeystaticAdmin from '@kit/keystatic/admin';
|
||||
|
||||
export default function Layout() {
|
||||
return (
|
||||
<KeystaticAdmin />
|
||||
);
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
redirect('/');
|
||||
}
|
||||
|
||||
return <KeystaticAdmin />;
|
||||
}
|
||||
Reference in New Issue
Block a user