mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-07 20:10:03 +03:00
Fixed issue where config initialization did not occur early enough in lifecycle, causing db.js to throw an error if the config did not exist
This commit is contained in:
@@ -54,7 +54,7 @@ const local_db_defaults = {}
|
||||
tables_list.forEach(table => {local_db_defaults[table] = []});
|
||||
local_db.defaults(local_db_defaults).write();
|
||||
|
||||
let using_local_db = config_api.getConfigItem('ytdl_use_local_db');
|
||||
let using_local_db = null;
|
||||
|
||||
function setDB(input_db, input_users_db) {
|
||||
db = input_db; users_db = input_users_db;
|
||||
@@ -69,6 +69,9 @@ function setLogger(input_logger) {
|
||||
exports.initialize = (input_db, input_users_db, input_logger) => {
|
||||
setDB(input_db, input_users_db);
|
||||
setLogger(input_logger);
|
||||
|
||||
// must be done here to prevent getConfigItem from being called before init
|
||||
using_local_db = config_api.getConfigItem('ytdl_use_local_db');
|
||||
}
|
||||
|
||||
exports.connectToDB = async (retries = 5, no_fallback = false) => {
|
||||
|
||||
Reference in New Issue
Block a user