From 18e233873552a081570582b75f1bd4bfe07f5c1d Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 8 Apr 2024 20:36:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20linter=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/save-config.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/services/save-config.js b/services/save-config.js index 1af0d299..07f62f3f 100644 --- a/services/save-config.js +++ b/services/save-config.js @@ -18,15 +18,15 @@ module.exports = async (newConfig, render) => { // Define constants for the config file const settings = { - defaultLocation: './public/', + defaultLocation: './user-data/', defaultFile: 'conf.yml', filename: 'conf', backupDenominator: '.backup.yml', }; // Make the full file name and path to save the backup config file - const backupFilePath = path.normalize(process.env.BACKUP_DIR || settings.defaultLocation) - + `/${usersFileName || settings.filename}-` + const backupFilePath = `${path.normalize(process.env.BACKUP_DIR || settings.defaultLocation) + }/${usersFileName || settings.filename}-` + `${Math.round(new Date() / 1000)}${settings.backupDenominator}`; // The path where the main conf.yml should be read and saved to @@ -48,12 +48,12 @@ module.exports = async (newConfig, render) => { // Makes a backup of the existing config file await fsPromises .copyFile(defaultFilePath, backupFilePath) - .catch((error) => render(getRenderMessage(false, `Unable to backup conf.yml: ${error}`))); + .catch((error) => render(getRenderMessage(false, `Unable to backup ${settings.defaultFile}: ${error}`))); // Writes the new content to the conf.yml file await fsPromises .writeFile(defaultFilePath, newConfig.config.toString(), writeFileOptions) - .catch((error) => render(getRenderMessage(false, `Unable to write to conf.yml: ${error}`))); + .catch((error) => render(getRenderMessage(false, `Unable to write to ${settings.defaultFile}: ${error}`))); // If successful, then render hasn't yet been called- call it await render(getRenderMessage(true));