mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
c5fa7ae1a6
Extracts all express-server-related code in index.js to core/server.js, leaving index.js purely for booting up Ghost's core components in a sensible order. Aside from the project's tidiness, this means that we can perform asynchronous configuration loading/checks before requiring any modules that read the config.
14 lines
454 B
JavaScript
14 lines
454 B
JavaScript
// # Ghost bootloader
|
|
// Orchestrates the loading of Ghost
|
|
|
|
var configLoader = require('./core/config-loader.js'),
|
|
error = require('./core/server/errorHandling');
|
|
|
|
// If no env is set, default to development
|
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
|
|
|
configLoader.loadConfig().then(function () {
|
|
// The server and its dependencies require a populated config
|
|
require('./core/server');
|
|
}).otherwise(error.logAndThrowError);
|