parent
1d2f1760c9
commit
c1899b5689
|
@ -346,7 +346,7 @@ When enabled all the exported JSON files will be minified.
|
||||||
|
|
||||||
### Import on bootstrap
|
### 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`
|
###### Key: `importOnBootstrap`
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ const fs = require('fs');
|
||||||
|
|
||||||
const ConfigType = require('./config/type');
|
const ConfigType = require('./config/type');
|
||||||
const defaultTypes = require('./config/types');
|
const defaultTypes = require('./config/types');
|
||||||
|
const { logMessage } = require('./utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An asynchronous bootstrap function that runs before
|
* An asynchronous bootstrap function that runs before
|
||||||
|
@ -38,6 +39,10 @@ module.exports = async () => {
|
||||||
|
|
||||||
// Import on bootstrap.
|
// Import on bootstrap.
|
||||||
if (strapi.config.get('plugin.config-sync.importOnBootstrap')) {
|
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'))) {
|
if (fs.existsSync(strapi.config.get('plugin.config-sync.syncDir'))) {
|
||||||
await strapi.plugin('config-sync').service('main').importAllConfig();
|
await strapi.plugin('config-sync').service('main').importAllConfig();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue