import getFeed from './rss-feed-poller';
import loadFile from './config-parser.js';

export default async function rssPoller(robot) {
  try {
    const config = await loadFile(process.env.HUBOT_RSS_CONFIG_FILE || 'hubotrssconfig.json');

    JSON.parse(config).feeds.map(x => getFeed({ ...x, robot }))
      .forEach(x => x.startFeed());
  } catch (err) {
    robot.logger.debug(err.message);
  }
}

import getFeed from './rss-feed-poller';
import loadFile from './config-parser.js';

export default async function rssPoller(robot) {
  try {
    const config = await loadFile(process.env.HUBOT_RSS_CONFIG_FILE || 'hubotrssconfig.json');

    if (!process.env.HUBOT_RSS_FEED_DISABLE) {
      JSON.parse(config).feeds.map(x => getFeed({ ...x, robot }))
        .forEach(x => x.startFeed());
    }
  } catch (err) {
    robot.logger.debug(err.message);
  }
}

Add env variable to disable this plugin
Add env variable to disable this plugin

This is necessary because we have a stage hubot and a real hubot at our
company and we don't want the stage hubot saying anything about the RSS
feeds.
