feat: Disallow use of importOnBootstrap in develop

pull/47/head 1.0.0-beta.7
Boaz Poolman 2022-01-25 17:35:37 +01:00
parent 1d2f1760c9
commit c1899b5689
2 changed files with 6 additions and 1 deletions

View File

@ -346,7 +346,7 @@ When enabled all the exported JSON files will be minified.
### Import on bootstrap
Allows you to let the config be imported automaticly when strapi is bootstrapping (on `strapi start`). This setting should never be used locally and should be handled very carefully as it can unintendedly overwrite the changes in your database. **PLEASE USE WITH CARE**.
Allows you to let the config be imported automaticly when strapi is bootstrapping (on `strapi start`). This setting can't be used locally and should be handled very carefully as it can unintendedly overwrite the changes in your database. **PLEASE USE WITH CARE**.
###### Key: `importOnBootstrap`

View File

@ -4,6 +4,7 @@ const fs = require('fs');
const ConfigType = require('./config/type');
const defaultTypes = require('./config/types');
const { logMessage } = require('./utils');
/**
* An asynchronous bootstrap function that runs before
@ -38,6 +39,10 @@ module.exports = async () => {
// Import on bootstrap.
if (strapi.config.get('plugin.config-sync.importOnBootstrap')) {
if (strapi.server.app.env === 'development') {
strapi.log.warn(logMessage(`You can't use the 'importOnBootstrap' setting in the development env.`));
return;
}
if (fs.existsSync(strapi.config.get('plugin.config-sync.syncDir'))) {
await strapi.plugin('config-sync').service('main').importAllConfig();
}