Fix exclude setting

pull/5/head
Boaz Poolman 2021-03-27 00:29:21 +01:00
parent 84c0afab0c
commit b6f1f354ea
3 changed files with 36 additions and 0 deletions

View File

@ -17,6 +17,10 @@ module.exports = {
const coreStore = await strapi.query(coreStoreQueryString).find({ _limit: -1 });
await Promise.all(Object.values(coreStore).map(async ({ id, ...config }) => {
// Check if the config should be excluded.
const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${config.key}`);
if (shouldExclude) return;
config.value = JSON.parse(config.value);
await strapi.plugins['config-sync'].services.main.writeConfigFile(configPrefix, config.key, config);
}));
@ -30,6 +34,10 @@ module.exports = {
* @returns {void}
*/
importSingle: async (configName, configContent) => {
// Check if the config should be excluded.
const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${configName}`);
if (shouldExclude) return;
const { value, ...fileContent } = configContent;
const coreStoreAPI = strapi.query(coreStoreQueryString);
@ -53,6 +61,10 @@ module.exports = {
let configs = {};
Object.values(coreStore).map( ({ id, value, key, ...config }) => {
// Check if the config should be excluded.
const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${key}`);
if (shouldExclude) return;
configs[`${configPrefix}.${key}`] = { key, value: JSON.parse(value), ...config };
});

View File

@ -34,6 +34,10 @@ module.exports = {
);
await Promise.all(sanitizedRolesArray.map(async (config) => {
// Check if the config should be excluded.
const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${config.type}`);
if (shouldExclude) return;
await strapi.plugins['config-sync'].services.main.writeConfigFile(configPrefix, config.type, config);
}));
},
@ -46,6 +50,10 @@ module.exports = {
* @returns {void}
*/
importSingle: async (configName, configContent) => {
// Check if the config should be excluded.
const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${configName}`);
if (shouldExclude) return;
const service =
strapi.plugins['users-permissions'].services.userspermissions;
@ -90,6 +98,10 @@ module.exports = {
let configs = {};
Object.values(sanitizedRolesArray).map((config) => {
// Check if the config should be excluded.
const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${config.type}`);
if (shouldExclude) return;
configs[`${configPrefix}.${config.type}`] = config;
});

View File

@ -17,6 +17,10 @@ module.exports = {
const webhooks = await strapi.query(webhookQueryString).find({ _limit: -1 });
await Promise.all(Object.values(webhooks).map(async (config) => {
// Check if the config should be excluded.
const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${config.id}`);
if (shouldExclude) return;
await strapi.plugins['config-sync'].services.main.writeConfigFile(configPrefix, config.id, config);
}));
},
@ -29,6 +33,10 @@ module.exports = {
* @returns {void}
*/
importSingle: async (configName, configContent) => {
// Check if the config should be excluded.
const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${configName}`);
if (shouldExclude) return;
const webhookAPI = strapi.query(webhookQueryString);
const configExists = await webhookAPI.findOne({ id: configName });
@ -50,6 +58,10 @@ module.exports = {
let configs = {};
Object.values(webhooks).map( (config) => {
// Check if the config should be excluded.
const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${config.id}`);
if (shouldExclude) return;
configs[`${configPrefix}.${config.id}`] = config;
});