2021-03-20 01:30:37 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An asynchronous bootstrap function that runs before
|
|
|
|
* your application gets started.
|
|
|
|
*
|
|
|
|
* This gives you an opportunity to set up your data model,
|
|
|
|
* run jobs, or perform some special logic.
|
|
|
|
*
|
|
|
|
* See more details here: https://strapi.io/documentation/v3.x/concepts/configurations.html#bootstrap
|
|
|
|
*/
|
|
|
|
|
2021-03-24 16:22:03 +01:00
|
|
|
module.exports = async () => {
|
2021-11-10 19:51:00 +01:00
|
|
|
// Import on bootstrap.
|
2021-03-21 18:04:18 +01:00
|
|
|
if (strapi.plugins['config-sync'].config.importOnBootstrap) {
|
|
|
|
if (fs.existsSync(strapi.plugins['config-sync'].config.destination)) {
|
2021-03-24 16:22:03 +01:00
|
|
|
await strapi.plugins['config-sync'].services.main.importAllConfig();
|
2021-03-20 01:30:37 +01:00
|
|
|
}
|
|
|
|
}
|
2021-11-10 19:51:00 +01:00
|
|
|
|
|
|
|
// Register permission actions.
|
|
|
|
const actions = [
|
|
|
|
{
|
|
|
|
section: 'plugins',
|
|
|
|
displayName: 'Access the plugin settings',
|
|
|
|
uid: 'settings.read',
|
|
|
|
pluginName: 'config-sync',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
section: 'plugins',
|
2021-11-11 22:43:52 +01:00
|
|
|
displayName: 'Menu link to plugin settings',
|
|
|
|
uid: 'menu-link',
|
2021-11-10 19:51:00 +01:00
|
|
|
pluginName: 'config-sync',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
await strapi.admin.services.permission.actionProvider.registerMany(actions);
|
2021-03-20 01:30:37 +01:00
|
|
|
};
|