mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
parent
a639e48715
commit
dc1ef35f0c
3 changed files with 8 additions and 20 deletions
|
@ -9,7 +9,6 @@ var path = require('path'),
|
|||
_ = require('lodash'),
|
||||
|
||||
validator = require('validator'),
|
||||
readDirectory = require('../utils/read-directory'),
|
||||
errors = require('../errors'),
|
||||
configUrl = require('./url'),
|
||||
packageInfo = require('../../../package.json'),
|
||||
|
@ -69,27 +68,12 @@ ConfigManager.prototype.getSocket = function () {
|
|||
};
|
||||
|
||||
ConfigManager.prototype.init = function (rawConfig) {
|
||||
var self = this;
|
||||
|
||||
// Cache the config.js object's environment
|
||||
// object so we can later refer to it.
|
||||
// Note: this is not the entirety of config.js,
|
||||
// just the object appropriate for this NODE_ENV
|
||||
self.set(rawConfig);
|
||||
|
||||
return self.loadApps()
|
||||
.then(function () {
|
||||
return self._config;
|
||||
});
|
||||
};
|
||||
|
||||
ConfigManager.prototype.loadApps = function () {
|
||||
var self = this;
|
||||
|
||||
return readDirectory(self._config.paths.appPath)
|
||||
.then(function (result) {
|
||||
self._config.paths.availableApps = result;
|
||||
});
|
||||
this.set(rawConfig);
|
||||
return this._config;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -219,7 +203,6 @@ ConfigManager.prototype.set = function (config) {
|
|||
adminViews: path.join(corePath, '/server/views/'),
|
||||
helperTemplates: path.join(corePath, '/server/helpers/tpl/'),
|
||||
|
||||
availableApps: this._config.paths.availableApps || {},
|
||||
clientAssets: path.join(corePath, '/built/assets/')
|
||||
},
|
||||
maintenance: {},
|
||||
|
|
|
@ -32,6 +32,7 @@ var express = require('express'),
|
|||
GhostServer = require('./ghost-server'),
|
||||
scheduling = require('./scheduling'),
|
||||
validateThemes = require('./utils/validate-themes'),
|
||||
readDirectory = require('./utils/read-directory'),
|
||||
dbHash;
|
||||
|
||||
function initDbHashAndFirstRun() {
|
||||
|
@ -74,6 +75,11 @@ function init(options) {
|
|||
// Load our config.js file from the local file system.
|
||||
return config.load(options.config).then(function () {
|
||||
return config.checkDeprecated();
|
||||
}).then(function loadApps() {
|
||||
return readDirectory(config.paths.appPath)
|
||||
.then(function (result) {
|
||||
config.paths.availableApps = result;
|
||||
});
|
||||
}).then(function () {
|
||||
return api.themes.loadThemes();
|
||||
}).then(function () {
|
||||
|
|
|
@ -110,7 +110,6 @@ describe('Config', function () {
|
|||
'imagesRelPath',
|
||||
'adminViews',
|
||||
'helperTemplates',
|
||||
'availableApps',
|
||||
'clientAssets'
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue