daedalus 907759456b refactor(bootstrap): move bootstrap code under single folder
feat(boostrapEvents): add wildcard support for uid and actions
2023-09-19 20:46:19 -04:00

21 lines
682 B
JavaScript

'use strict';
const { getService } = require('../utils/common');
const { bootstrapCron } = require('./bootstrapCron');
const { bootstrapEvents } = require('./bootstrapEvents');
module.exports = async ({ strapi }) => {
const builds = getService({ strapi, name: 'settings' }).get({ path: 'builds' });
builds
.filter((b) => b.enabled || typeof b.enabled === 'undefined')
.forEach((build) => {
if (build.trigger.type === 'cron') {
bootstrapCron({ strapi, build });
} else if (build.trigger.type === 'event') {
bootstrapEvents({ strapi, build });
}
strapi.log.info(`[website builder] ${build.trigger.type} trigger enabled for ${build.name} build`);
});
};