From 587e1ba268242212462fb36bc0c6b9740071604d Mon Sep 17 00:00:00 2001 From: 3nprob <3nprob@3nprob> Date: Thu, 25 Nov 2021 21:49:48 +0900 Subject: [PATCH] Only log request error stacktrace if RIMGU_DEBUG is set --- src/config.ts | 1 + src/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index 409dc76..a83dd8d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -7,4 +7,5 @@ export default { imgur_client_id: process.env.RIMGU_IMGUR_CLIENT_ID || null, use_api: process.env.RIMGU_USE_API && process.env.RIMGU_USE_API !== 'false', page_title: process.env.RIMGU_PAGE_TITLE || 'rimgu', + debug: process.env.RIMGU_DEBUG && process.env.RIMGU_DEBUG !== 'false', }; diff --git a/src/index.ts b/src/index.ts index 1ff8625..bc07ca4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,9 +15,9 @@ const server = Hapi.server({ relativeTo: Path.join(__dirname, 'static') } }, - debug: { + debug: CONFIG.debug ? { request: ['error'] - }, + } : {}, }); server.events.on('stop', () => { console.log('Server stopped.');