index.js
function formatConfig (config) {
  _.defaults(config, {debug: false, plugins: []})

  config.debugOptions = config.debugOptions || {}
  config.connectedTeams = new Set()

  if (!Array.isArray(config.plugins)) {
    config.plugins = [config.plugins]
  }

  config.scopes = _.chain(config.plugins)
    .map('scopes')
    .flatten()
    .concat(_.isArray(config.scopes) ? config.scopes : [])
    .uniq()
    .remove(_.isString.bind(_))
    .value()

  config.isSlackApp = !config.slackToken

  if (!config.slackToken && !(config.clientId && config.clientSecret && config.port)) {
    logger.error(`Missing configuration. Config must include either slackToken AND/OR clientId, clientSecret, and port`)
    process.exit(1)
  }
}
function formatConfig (config) {
  _.defaults(config, {debug: false, plugins: []})

  config.debugOptions = config.debugOptions || {}
  config.connectedTeams = new Set()

  if (!Array.isArray(config.plugins)) {
    config.plugins = [config.plugins]
  }

  config.scopes = _.chain(config.plugins)
    .map('scopes')
    .flatten()
    .concat(_.isArray(config.scopes) ? config.scopes : [])
    .uniq()
    .remove(_.isString.bind(_))
    .value()

  config.isSlackApp = !config.slackToken

  if (!config.slackToken && !(config.clientId && config.clientSecret && config.port)) {
    logger.error(`Missing configuration. Config must include either slackToken AND/OR clientId, clientSecret, and port`)
    process.exit(1)
  }
}
function formatConfig ( config ) { _ . defaults ( config , { debug : false , plugins : [ ] } ) config . debugOptions = config . debugOptions || { } config . connectedTeams = new Set ( ) if ( ! Array . isArray ( config . plugins ) ) { config . plugins = [ config . plugins ] } config . scopes = _ . chain ( config . plugins ) . map ( 'scopes' ) . flatten ( ) . concat ( _ . isArray ( config . scopes ) ? config . scopes : [ ] ) . uniq ( ) . remove ( _ . isString . bind ( _ ) ) . value ( ) config . isSlackApp = ! config . slackToken if ( ! config . slackToken && ! ( config . clientId && config . clientSecret && config . port ) ) { logger . error ( ` ` ) process . exit ( 1 ) } }
Formats config values so they are normalized, will exit the process with an error if required config is missing

@param config
Formats config values so they are normalized will exit the process with an error if required config is missing