Disable API by default

Add helpful logging and init check
This commit is contained in:
3nprob 2021-10-08 03:00:29 +09:00
parent a88c323fb3
commit 5047952935
2 changed files with 8 additions and 1 deletions

View File

@ -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',
};

View File

@ -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();