diff --git a/src/config.ts b/src/config.ts index a05e3c0..409dc76 100644 --- a/src/config.ts +++ b/src/config.ts @@ -5,6 +5,6 @@ export default { http_proxy: process.env.RIMGU_HTTP_PROXY || null, https_proxy: process.env.RIMGU_HTTPS_PROXY || null, imgur_client_id: process.env.RIMGU_IMGUR_CLIENT_ID || null, - use_api: process.env.RIMGU_USE_API !== 'false', + use_api: process.env.RIMGU_USE_API && process.env.RIMGU_USE_API !== 'false', page_title: process.env.RIMGU_PAGE_TITLE || 'rimgu', }; diff --git a/src/index.ts b/src/index.ts index 26ce76a..b85e9d4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -80,4 +80,11 @@ process.on('unhandledRejection', (err) => { process.exit(1); }); +if (!CONFIG.use_api) { + console.log('Running without imgur client ID; certain views and functionality missing.'); +} else if (!CONFIG.imgur_client_id) { + console.error('imgur_client_id missing. Configure it via RIMGU_IMGUR_CLIENT_ID or set RIMGU_USE_API=false'); + process.exit(1); +} + init();