Skip to content

Commit

Permalink
feat: dynamically disable client if module not found instead of relyi…
Browse files Browse the repository at this point in the history
…ng on env var
  • Loading branch information
nojhamster committed Sep 12, 2024
1 parent 5da1ea8 commit d50ade1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,14 @@ app.use((err, req, res, next) => {
}
});

// Setup client if needed
if (!process.env.EZPAARSE_NO_WEB_CLIENT) {
// Setup client if client dependencies are installed
try {
// eslint-disable-next-line global-require
app.use(require('./client/index.js')({ isDev }));
} else {
} catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') {
throw e;
}
logger.warn('Web client is disabled');
}

Expand Down

0 comments on commit d50ade1

Please sign in to comment.