<commit_before>var mqtt = require('mqtt'),
    fs = require('fs'),
    url = require('url'),
    config = require('config');

module.exports.connect = function () {
  var caCert,
      mqttBroker = url.format( config.get('brokerNode') ),
      instance;

  if (config.get('broker.caFile')) {
    caCert = fs.readFileSync('./certs/' + config.get('broker.caFile'));
  }

  console.log('Connecting to: ', mqttBroker);

  instance = mqtt.connect(mqttBroker, { ca: caCert });

  return instance;
}

/*
  ciot/kit0/<device>/<action>/<type><commit_msg>Fix typo fetching config for node broker connection<commit_after>var mqtt = require('mqtt'),
    fs = require('fs'),
    url = require('url'),
    config = require('config');

module.exports.connect = function () {
  var caCert,
      mqttBroker = url.format( config.get('brokerNode') ),
      instance;

  if (config.get('brokerNode.caFile')) {
    caCert = fs.readFileSync('./certs/' + config.get('brokerNode.caFile'));
  }

  console.log('Connecting to: ', mqttBroker);

  instance = mqtt.connect(mqttBroker, { ca: caCert });

  return instance;
}

/*
  ciot/kit0/<device>/<action>/<type>
{'fraction_non_alphanumeric': 0.1813380281690141, 'fraction_numerical': 0.0017605633802816902, 'mean_word_length': 3.6983471074380163, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4838257', 'n_tokens_mistral': 403, 'n_tokens_neox': 392, 'n_words': 70}