feat: Allow other plugin to register their own config types
parent
fea127f7b2
commit
a7bfd3fd4b
|
@ -21,12 +21,21 @@ module.exports = async () => {
|
||||||
const registerTypes = () => {
|
const registerTypes = () => {
|
||||||
const types = {};
|
const types = {};
|
||||||
|
|
||||||
|
// The default types provided by the plugin.
|
||||||
defaultTypes(strapi).map((type) => {
|
defaultTypes(strapi).map((type) => {
|
||||||
if (!strapi.config.get('plugin.config-sync.excludedTypes').includes(type.configName)) {
|
if (!strapi.config.get('plugin.config-sync.excludedTypes').includes(type.configName)) {
|
||||||
types[type.configName] = new ConfigType(type);
|
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) => {
|
strapi.config.get('plugin.config-sync.customTypes').map((type) => {
|
||||||
if (!strapi.config.get('plugin.config-sync.excludedTypes').includes(type.configName)) {
|
if (!strapi.config.get('plugin.config-sync.excludedTypes').includes(type.configName)) {
|
||||||
types[type.configName] = new ConfigType(type);
|
types[type.configName] = new ConfigType(type);
|
||||||
|
|
|
@ -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 = [];
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,5 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const register = require('./server/register');
|
||||||
const bootstrap = require('./server/bootstrap');
|
const bootstrap = require('./server/bootstrap');
|
||||||
const services = require('./server/services');
|
const services = require('./server/services');
|
||||||
const routes = require('./server/routes');
|
const routes = require('./server/routes');
|
||||||
|
@ -8,6 +9,7 @@ const controllers = require('./server/controllers');
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
return {
|
return {
|
||||||
|
register,
|
||||||
bootstrap,
|
bootstrap,
|
||||||
routes,
|
routes,
|
||||||
config,
|
config,
|
||||||
|
|
Loading…
Reference in New Issue