Removed unnecessary async statements

refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings

- These methods are completely sync, there's no need to complicate it with artificial "async" method signatures. Even if used in then chains or with await these methods should still work!
This commit is contained in:
Naz 2021-09-27 16:49:00 +02:00 committed by naz
parent dd042d69c9
commit 2fc26bd80a

View File

@ -32,17 +32,13 @@ const messages = {
const filename = 'routes';
const ext = 'yaml';
const getSettingsFolder = async () => {
return config.getContentPath('settings');
};
const getSettingsFilePath = async () => {
const settingsFolder = await getSettingsFolder();
const getSettingsFilePath = () => {
const settingsFolder = config.getContentPath('settings');
return path.join(settingsFolder, `${filename}.${ext}`);
};
const getBackupFilePath = async () => {
const settingsFolder = await getSettingsFolder();
const getBackupFilePath = () => {
const settingsFolder = config.getContentPath('settings');
return path.join(settingsFolder, `${filename}-${moment().format('YYYY-MM-DD-HH-mm-ss')}.${ext}`);
};
@ -76,8 +72,8 @@ const readFile = (settingsFilePath) => {
};
const setFromFilePath = async (filePath) => {
const settingsPath = await getSettingsFilePath();
const backupPath = await getBackupFilePath();
const settingsPath = getSettingsFilePath();
const backupPath = getBackupFilePath();
await createBackupFile(settingsPath, backupPath);
await saveFile(filePath, settingsPath);