2021-09-28 10:47:42 +03:00
|
|
|
const routeSettings = require('./route-settings');
|
|
|
|
const SettingsLoader = require('./loader');
|
2021-09-29 21:56:55 +03:00
|
|
|
const config = require('../../../shared/config');
|
|
|
|
const DefaultSettingsManager = require('./default-settings-manager');
|
|
|
|
|
|
|
|
const defaultSettingsManager = new DefaultSettingsManager({
|
|
|
|
type: 'routes',
|
|
|
|
extension: '.yaml',
|
|
|
|
destinationFolderPath: config.getContentPath('settings'),
|
|
|
|
sourceFolderPath: config.get('paths').defaultSettings
|
|
|
|
});
|
2021-09-28 10:47:42 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
init: async () => {
|
2021-09-29 21:56:55 +03:00
|
|
|
return await defaultSettingsManager.ensureSettingsFileExists();
|
2021-09-28 10:47:42 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
loadRouteSettingsSync: SettingsLoader.loadSettingsSync,
|
|
|
|
loadRouteSettings: SettingsLoader.loadSettings,
|
|
|
|
getDefaultHash: routeSettings.getDefaultHash,
|
|
|
|
/**
|
|
|
|
* Methods used in the API
|
|
|
|
*/
|
|
|
|
api: {
|
|
|
|
setFromFilePath: routeSettings.setFromFilePath,
|
|
|
|
get: routeSettings.get,
|
|
|
|
getCurrentHash: routeSettings.getCurrentHash
|
|
|
|
}
|
|
|
|
};
|