mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 07:51:55 +03:00
050f1751c4
refs #5091 - remove the use of functions - remove unnecessary quotes from tag filter - move channel config to be a JSOn file called config.channels.json - accept external config - new channelUtils for tests - remove channelConfig.get - refactor so tests work as expected - refactor away duplicate 'name' value
28 lines
837 B
JavaScript
28 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;
|
|
};
|