Merge pull request #3453 from strapi/tech/require-bootstrap-file-first

Requiring bootstrap.js before config loading
This commit is contained in:
Alexandre BODIN 2019-06-14 23:40:12 +02:00 committed by GitHub
commit 0fc7b72c42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
const http = require('http');
const path = require('path');
const { EventEmitter } = require('events');
const fse = require('fs-extra');
const Koa = require('koa');
const _ = require('lodash');
const { logger, models } = require('strapi-utils');
@ -102,6 +103,17 @@ class Strapi extends EventEmitter {
this.fs = createStrapiFs(this);
}
requireProjectBootstrap() {
const bootstrapPath = path.resolve(
this.dir,
'config/functions/bootstrap.js'
);
if (fse.existsSync(bootstrapPath)) {
require(bootstrapPath);
}
}
async start(cb) {
try {
// Emit starting event.