<commit_before>var yaml = require('js-yaml');
var fs = require('fs');
var _ = require('underscore');
var Validator = require('jsonschema').Validator;

function Config(path) {
  var content = yaml.safeLoad(fs.readFileSync(path, 'utf8'));
  Config._validate(content);
  this._hash = content;
  if (this._hash.ssl) {
    this._processSSL();
  }
}

/**
 * @returns {Object}
 */
Config.prototype.asHash = function() {
  return this._hash;
};

var validator = new Validator();

validator.attributes.validateSsl = function(config) {
  if (config.auth && !config.ssl) {
    return 'Ssl options are required';
  }
};

validator.attributes.validateSslPfx = function(ssl) {
  if (ssl && (!ssl.key || !ssl.cert) && !ssl.pfx) {
    return 'Ssl options must contain pair of `key` and `cert` or `pfx`';
  }
};

var validScheme = {
  type: 'object',
  validateSsl: true,
  properties: {
    port: {
      type: 'number',
      required: true
    },
    logPath: {
      type: 'string',
      required: true
    },
    mongodb: {
      type: 'object',
      required: true,
      properties: {
        host: {
          type: 'string',
          required: true
        },
        db: {
          type: 'string',
          required: true
        },
        port: {
          type: 'number',
          required: true
        }
      }
    },
    pulsar: {
      type: 'object',
      properties: {
        repo: {type: 'string'},
        branch: {type: 'string'}
      }
    },
    auth: {
      type: 'object',<commit_msg>Make config.pulsar.repo mandatory.<commit_after>var yaml = require('js-yaml');
var fs = require('fs');
var _ = require('underscore');
var Validator = require('jsonschema').Validator;

function Config(path) {
  var content = yaml.safeLoad(fs.readFileSync(path, 'utf8'));
  Config._validate(content);
  this._hash = content;
  if (this._hash.ssl) {
    this._processSSL();
  }
}

/**
 * @returns {Object}
 */
Config.prototype.asHash = function() {
  return this._hash;
};

var validator = new Validator();

validator.attributes.validateSsl = function(config) {
  if (config.auth && !config.ssl) {
    return 'Ssl options are required';
  }
};

validator.attributes.validateSslPfx = function(ssl) {
  if (ssl && (!ssl.key || !ssl.cert) && !ssl.pfx) {
    return 'Ssl options must contain pair of `key` and `cert` or `pfx`';
  }
};

var validScheme = {
  type: 'object',
  validateSsl: true,
  properties: {
    port: {
      type: 'number',
      required: true
    },
    logPath: {
      type: 'string',
      required: true
    },
    mongodb: {
      type: 'object',
      required: true,
      properties: {
        host: {
          type: 'string',
          required: true
        },
        db: {
          type: 'string',
          required: true
        },
        port: {
          type: 'number',
          required: true
        }
      }
    },
    pulsar: {
      type: 'object',
      required: true,
      properties: {
        repo: {
          type: 'string',
          required: true
        },
        branch: {type: 'string'}
      }
    },
    auth: {
      type: 'object',
{'fraction_non_alphanumeric': 0.15466580561834034, 'fraction_numerical': 0.0006457862447529867, 'mean_word_length': 2.1612244897959183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7409518', 'n_tokens_mistral': 1005, 'n_tokens_neox': 1004, 'n_words': 231}