Ghost/core/server/themes/config/index.js
Hannah Wolfe 317daf5549 🎨 🚨 Split theme tests, clean config & add tests (#8205)
refs #7491

- split themes_spec up into several files
- clean up the code for configuration
- ensure its tested
2017-03-22 07:52:58 +01:00

14 lines
384 B
JavaScript

var _ = require('lodash'),
defaultConfig = require('./defaults'),
allowedKeys = ['posts_per_page'];
module.exports.create = function configLoader(packageJson) {
var config = _.cloneDeep(defaultConfig);
if (packageJson && packageJson.hasOwnProperty('config')) {
config = _.assign(config, _.pick(packageJson.config, allowedKeys));
}
return config;
};