diff --git a/server/bootstrap.js b/server/bootstrap.js index 6246dcd..2f88ee4 100644 --- a/server/bootstrap.js +++ b/server/bootstrap.js @@ -21,12 +21,21 @@ module.exports = async () => { const registerTypes = () => { const types = {}; + // The default types provided by the plugin. defaultTypes(strapi).map((type) => { if (!strapi.config.get('plugin.config-sync.excludedTypes').includes(type.configName)) { types[type.configName] = new ConfigType(type); } }); + // The types provided by other plugins. + strapi.plugin('config-sync').pluginTypes.map((type) => { + if (!strapi.config.get('plugin.config-sync.excludedTypes').includes(type.configName)) { + types[type.configName] = new ConfigType(type); + } + }); + + // The custom types provided by the user. strapi.config.get('plugin.config-sync.customTypes').map((type) => { if (!strapi.config.get('plugin.config-sync.excludedTypes').includes(type.configName)) { types[type.configName] = new ConfigType(type); diff --git a/server/register.js b/server/register.js new file mode 100644 index 0000000..c914fed --- /dev/null +++ b/server/register.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = async ({ strapi }) => { + // Instantiate the pluginTypes array. + if (!strapi.plugin('config-sync').pluginTypes) { + strapi.plugin('config-sync').pluginTypes = []; + } +}; diff --git a/strapi-server.js b/strapi-server.js index 23b458a..0534db6 100644 --- a/strapi-server.js +++ b/strapi-server.js @@ -1,5 +1,6 @@ 'use strict'; +const register = require('./server/register'); const bootstrap = require('./server/bootstrap'); const services = require('./server/services'); const routes = require('./server/routes'); @@ -8,6 +9,7 @@ const controllers = require('./server/controllers'); module.exports = () => { return { + register, bootstrap, routes, config,