Skip to content

Commit 0d4acac

Browse files
committed
fix: exit server when field discovery fails in production
Prevent server from running with incomplete field discovery in production environment to avoid potential data inconsistencies and runtime errors. This ensures data integrity by failing fast when database schema cannot be properly discovered.
1 parent fe19ef2 commit 0d4acac

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

adminforth/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,9 @@ class AdminForth implements IAdminForth {
339339
}
340340
if (fieldTypes === null) {
341341
console.error(`⛔ DataSource ${res.dataSource} was not able to perform field discovery. It will not work properly`);
342+
if (process.env.NODE_ENV === 'production') {
343+
process.exit(1);
344+
}
342345
return;
343346
}
344347
if (!res.columns) {

0 commit comments

Comments
 (0)