File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ import { env } from "../../core";
77// to be separate unlike old implementation
88
99export const openapi = async ( server : FastifyInstance ) => {
10- if ( process . env . NODE_ENV === "production" ) {
11- return Promise . resolve ( ) ;
12- }
1310 await server . register ( swagger , {
1411 mode : "dynamic" ,
1512 openapi : {
Original file line number Diff line number Diff line change @@ -26,6 +26,16 @@ const createServer = async (serverName: string): Promise<FastifyInstance> => {
2626 ) ;
2727 }
2828
29+ if ( process . env . NODE_ENV === "production" ) {
30+ if ( request . routerPath ?. includes ( "static" ) ) {
31+ return reply . status ( 404 ) . send ( {
32+ statusCode : 404 ,
33+ error : "Not Found" ,
34+ message : "Not Found" ,
35+ } ) ;
36+ }
37+ }
38+
2939 const { url } = request ;
3040 // Skip Authentication for Health Check and Static Files and JSON Files for Swagger
3141 // Doing Auth check onRequest helps prevent unauthenticated requests from consuming server resources.
You can’t perform that action at this time.
0 commit comments