diff --git a/services/core-store.js b/services/core-store.js index 975dd3b..57c2039 100644 --- a/services/core-store.js +++ b/services/core-store.js @@ -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 }; }); diff --git a/services/role-permissions.js b/services/role-permissions.js index 18234b4..406899a 100644 --- a/services/role-permissions.js +++ b/services/role-permissions.js @@ -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; }); diff --git a/services/webhooks.js b/services/webhooks.js index e8068a5..3b98ede 100644 --- a/services/webhooks.js +++ b/services/webhooks.js @@ -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; });