mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 07:51:55 +03:00
c8c02a65fa
fixes #1575 - Moves most code that was in ghost.js into ./core/server/index.js - Creates ./core/server/config/theme.js to hold all theme configurations (which previously lived on ghost.blogGlobals()) - Removed ghost.server, passing it in as an argument where needed and allowing middleware to hold onto a reference for lazy use.
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
// General entry point for all configuration data
|
|
//
|
|
// This file itself is a wrapper for the root level config.js file.
|
|
// All other files that need to reference config.js should use this file.
|
|
|
|
var loader = require('./loader'),
|
|
paths = require('./paths'),
|
|
theme = require('./theme'),
|
|
ghostConfig;
|
|
|
|
// Returns NODE_ENV config object
|
|
function config() {
|
|
// @TODO: get rid of require statement.
|
|
// This is currently needed for tests to load config file
|
|
// successfully. While running application we should never
|
|
// have to directly delegate to the config.js file.
|
|
return ghostConfig || require(paths().config)[process.env.NODE_ENV];
|
|
}
|
|
|
|
function loadConfig() {
|
|
return loader().then(function (config) {
|
|
// Cache the config.js object's environment
|
|
// object so we can later refer to it.
|
|
// Note: this is not the entirity of config.js,
|
|
// just the object appropriate for this NODE_ENV
|
|
ghostConfig = config;
|
|
});
|
|
}
|
|
|
|
config.load = loadConfig;
|
|
config.paths = paths;
|
|
config.theme = theme;
|
|
|
|
module.exports = config; |