Ghost/core/frontend/services/theme-engine/config/index.js
Hannah Wolfe c687df21e1 Moved theme config to new theme engine service
refs: bf0823c9a2

- continuing the work of splitting up the theme service into logical components
2021-04-21 14:21:32 +01:00

14 lines
428 B
JavaScript

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