Ghost/index.js
Adam Howard c5fa7ae1a6 Refactor the initial boot of Ghost, allowing Ghost updates to keep current configuration intact.
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.
2013-09-14 14:04:08 +01:00

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);