Setting to import config during the bootstrapping of strapi
parent
d77a487235
commit
705599daaf
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"destination": "extensions/config/files/",
|
||||
"minify": false,
|
||||
"importOnBootstrap": false,
|
||||
"exclude": []
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
/**
|
||||
* An asynchronous bootstrap function that runs before
|
||||
* your application gets started.
|
||||
*
|
||||
* This gives you an opportunity to set up your data model,
|
||||
* run jobs, or perform some special logic.
|
||||
*
|
||||
* See more details here: https://strapi.io/documentation/v3.x/concepts/configurations.html#bootstrap
|
||||
*/
|
||||
|
||||
module.exports = () => {
|
||||
if (strapi.plugins.config.config.importOnBootstrap) {
|
||||
if (fs.existsSync(strapi.plugins.config.config.destination)) {
|
||||
const configFiles = fs.readdirSync(strapi.plugins.config.config.destination);
|
||||
|
||||
configFiles.map((file) => {
|
||||
strapi.plugins.config.services.config.importFromFile(file.slice(0, -5));
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue