Skip to content

Commit c1899b5

Browse files
committed
feat: Disallow use of importOnBootstrap in develop
1 parent 1d2f176 commit c1899b5

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ When enabled all the exported JSON files will be minified.
346346
347347
### Import on bootstrap
348348

349-
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**.
349+
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**.
350350

351351
###### Key: `importOnBootstrap`
352352

server/bootstrap.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const fs = require('fs');
44

55
const ConfigType = require('./config/type');
66
const defaultTypes = require('./config/types');
7+
const { logMessage } = require('./utils');
78

89
/**
910
* An asynchronous bootstrap function that runs before
@@ -38,6 +39,10 @@ module.exports = async () => {
3839

3940
// Import on bootstrap.
4041
if (strapi.config.get('plugin.config-sync.importOnBootstrap')) {
42+
if (strapi.server.app.env === 'development') {
43+
strapi.log.warn(logMessage(`You can't use the 'importOnBootstrap' setting in the development env.`));
44+
return;
45+
}
4146
if (fs.existsSync(strapi.config.get('plugin.config-sync.syncDir'))) {
4247
await strapi.plugin('config-sync').service('main').importAllConfig();
4348
}

0 commit comments

Comments
 (0)