use centralized config

This commit is contained in:
Araxeus
2023-03-04 15:48:15 +02:00
parent 7b3280c12b
commit ad484ab745
4 changed files with 46 additions and 29 deletions

View File

@ -0,0 +1,23 @@
const { setOptions, setMenuOptions } = require("../../config/plugins");
const defaultConfig = require("../../config/defaults");
let config = defaultConfig.plugins["downloader"];
module.exports.init = (options) => {
config = { ...config, ...options };
};
module.exports.setAndMaybeRestart = (option, value) => {
config[option] = value;
setMenuOptions("downloader", config);
};
module.exports.set = (option, value) => {
config[option] = value;
setOptions("downloader", config);
};
module.exports.get = (option) => {
let res = config[option];
return res;
};