Renamved activate/serve methods as suggested in discussions
This commit is contained in:
parent
f3b4e2e39a
commit
a84c15689e
@ -17,7 +17,7 @@ const config = require('../../../server/config');
|
||||
* - we don't destroy the resources, we only release them (this avoids reloading all resources from the db again)
|
||||
* - then we reload the whole site app, which will reset all routers and re-create the url generators
|
||||
*/
|
||||
const activate = (filePath) => {
|
||||
const setFromFilePath = (filePath) => {
|
||||
const settingsPath = config.getContentPath('settings');
|
||||
const backupRoutesPath = path.join(settingsPath, `routes-${moment().format('YYYY-MM-DD-HH-mm-ss')}.yaml`);
|
||||
|
||||
@ -77,7 +77,7 @@ const activate = (filePath) => {
|
||||
});
|
||||
};
|
||||
|
||||
const serve = () => {
|
||||
const get = () => {
|
||||
const routesPath = path.join(config.getContentPath('settings'), 'routes.yaml');
|
||||
|
||||
return fs.readFile(routesPath, 'utf-8')
|
||||
@ -96,5 +96,5 @@ const serve = () => {
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.activate = activate;
|
||||
module.exports.serve = serve;
|
||||
module.exports.setFromFilePath = setFromFilePath;
|
||||
module.exports.get = get;
|
||||
|
@ -254,14 +254,14 @@ settings = {
|
||||
upload(options) {
|
||||
return localUtils.handlePermissions('settings', 'edit')(options)
|
||||
.then(() => {
|
||||
return frontendSettings.dynamicRouting.activate(options.path);
|
||||
return frontendSettings.dynamicRouting.setFromFilePath(options.path);
|
||||
});
|
||||
},
|
||||
|
||||
download(options) {
|
||||
return localUtils.handlePermissions('settings', 'browse')(options)
|
||||
.then(() => {
|
||||
return frontendSettings.dynamicRouting.serve();
|
||||
return frontendSettings.dynamicRouting.get();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -147,7 +147,7 @@ module.exports = {
|
||||
method: 'edit'
|
||||
},
|
||||
query(frame) {
|
||||
return frontendSettings.dynamicRouting.activate(frame.file.path);
|
||||
return frontendSettings.dynamicRouting.setFromFilePath(frame.file.path);
|
||||
}
|
||||
},
|
||||
|
||||
@ -165,7 +165,7 @@ module.exports = {
|
||||
method: 'browse'
|
||||
},
|
||||
query() {
|
||||
return frontendSettings.dynamicRouting.serve();
|
||||
return frontendSettings.dynamicRouting.get();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user