0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00
ghost/core/server/controllers/channels/loader.js
Hannah Wolfe 05729d2f29 Group channel-handling code together
refs #5091

- Move all of the code to do with handling channels into one folder
- Still keeping all the shared/simlar code for rendering etc inside weird
  frontend folder until I am sure what this will look like
2017-10-25 18:48:47 +01:00

27 lines
837 B
JavaScript

var _ = require('lodash'),
channels = [];
function loadConfig() {
var channelConfig = {};
// This is a very dirty temporary hack so that we can test out channels with some Beta testers
// If you are reading this code, and considering using it, best reach out to us on Slack
// Definitely don't be angry at us if the structure of the JSON changes or this goes away.
try {
channelConfig = require('../../../../config.channels.json');
} catch (err) {
channelConfig = require('./config.channels.json');
}
return channelConfig;
}
module.exports.list = function list() {
_.each(loadConfig(), function (channelConfig, channelName) {
var channel = _.cloneDeep(channelConfig);
channel.name = channelName;
channels.push(channel);
});
return channels;
};