Add reload settings method, reload settings when DB updated
This commit is contained in:
1 parent
0832e8438a
commit
97419b436c
2 files changed
+14
No files matched your search
@@ -22,6 +22,19 @@ class SettingsService {
|
||||
}
|
||||
}
|
||||
|
||||
async reloadSettings() {
|
||||
try {
|
||||
this.settings = await AppSettings.findOne();
|
||||
if (!this.settings) {
|
||||
throw new Error("Settings not found");
|
||||
}
|
||||
} catch (error) {
|
||||
error.service === undefined ? (error.service = SERVICE_NAME) : null;
|
||||
error.method === undefined ? (error.method = "reloadSettings") : null;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
getSettings() {
|
||||
if (!this.settings) {
|
||||
throw new Error("Settings have not been loaded");
|
||||
|
||||
Reference in new issue
Block a user