<commit_before>/*jslint node: true*/
"use strict";

var path = require('path');
var regexp = require('node-regexp');
var S = require('string');
var debug = require('./logging').settings;

module.exports = params;

function params(argv) {
  var opts = {};
  opts.leavePatchConnectionOpen = false;
  opts.aclSuffix = argv.aclSuffix || ",acl";
  opts.uriBase = argv.uriBase ||
      'http://localhost:3000' + process.cwd() + '/test/';
  opts.fileBase = argv.fileBase || process.cwd() + '/test/';
  if (!(S(opts.fileBase).endsWith('/'))) {
      opts.fileBase += '/';
  }
  opts.address = argv.a || '0.0.0.0';
  opts.verbose = argv.v;
  opts.changesSuffix = argv.changesSuffix || ',changes';
  opts.SSESuffix = argv.SSESuffix || ',events';
  opts.ssl = argv.S;
  opts.cors = argv.cors;
  debug("uriBase: " + opts.uriBase);

  opts.pathStart = '/' +
    opts.uriBase
    .split('//')[1]
    .split('/')
    .slice(1)
    .join('/');

  opts.prePathSlash = opts.uriBase
    .split('/')
    .slice(0, 3)
    .join('/');

  debug("URI pathStart: " + opts.pathStart);
  opts.pathFilter = regexp().start(opts.pathStart).toRegExp();
  opts.xssProxy = argv.xssProxy;
  opts.proxyFilter = regexp().start(opts.xssProxy).toRegExp();
  opts.live = argv.live;
  opts.webid = argv.webid ? true : false;
  opts.privateKey = argv.privateKey || path.join(opts.fileBase, 'key.pem');
  opts.cert = argv.cert || path.join(opts.fileBase, 'cert.pem');

  // TODO this should be an attribute of an object
  opts.usedURIs = {};
  
  debug("URI path filter regexp: " + opts.pathFilter);
  debug("Verbose: " + !!opts.verbose);
  debug("Live: " + !!opts.live);

  return opts
}<commit_msg>use current working directory on fileBase<commit_after>/*jslint node: true*/
"use strict";

var path = require('path');
var regexp = require('node-regexp');
var S = require('string');
var debug = require('./logging').settings;

module.exports = params;

function params(argv) {
  var opts = {};
  opts.leavePatchConnectionOpen = false;
  opts.aclSuffix = argv.aclSuffix || ",acl";
  opts.uriBase = argv.uriBase ||
      'http://localhost:3000' + process.cwd() + '/test/';
  opts.fileBase = argv.fileBase || process.cwd();
  if (!(S(opts.fileBase).endsWith('/'))) {
      opts.fileBase += '/';
  }
  opts.address = argv.a || '0.0.0.0';
  opts.verbose = argv.v;
  opts.changesSuffix = argv.changesSuffix || ',changes';
  opts.SSESuffix = argv.SSESuffix || ',events';
  opts.ssl = argv.S;
  opts.cors = argv.cors;
  debug("uriBase: " + opts.uriBase);

  opts.pathStart = '/' +
    opts.uriBase
    .split('//')[1]
    .split('/')
    .slice(1)
    .join('/');

  opts.prePathSlash = opts.uriBase
    .split('/')
    .slice(0, 3)
    .join('/');

  debug("URI pathStart: " + opts.pathStart);
  opts.pathFilter = regexp().start(opts.pathStart).toRegExp();
  opts.xssProxy = argv.xssProxy;
  opts.proxyFilter = regexp().start(opts.xssProxy).toRegExp();
  opts.live = argv.live;
  opts.webid = argv.webid ? true : false;
  opts.privateKey = argv.privateKey || path.join(opts.fileBase, 'key.pem');
  opts.cert = argv.cert || path.join(opts.fileBase, 'cert.pem');

  // TODO this should be an attribute of an object
  opts.usedURIs = {};

  debug("URI path filter regexp: " + opts.pathFilter);
  debug("Verbose: " + !!opts.verbose);
  debug("Live: " + !!opts.live);

  return opts
}
{'fraction_non_alphanumeric': 0.1966376463524467, 'fraction_numerical': 0.00720504353047133, 'mean_word_length': 3.395778364116095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6143338', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1188, 'n_words': 230}