<commit_before>/* Basic SWM app */

var path = require('path');

var express = require('express');
var logger = require('morgan');

var debug = require('debug')('swim:app');

var swim = require('./');

var _config = null;

try {
  _config = require(path.resolve(process.cwd(),
        process.env.CONFIG_FILE || 'config.json'));
} catch (error) {
  if (error.code === 'MODULE_NOT_FOUND') {
    console.error(process.env.CONFIG_FILE ? 'Config file not found'
        : 'No config.json available');
  } else {
    console.error('Invalid config');
  }
  process.exit(1);
}

function getPort() {
  return process.env.PORT || 3000;
}

var config = {
  root: process.argv[2] || _config.root || path.join(__dirname, 'content'),

  working:   path.join(__dirname, '.data'),
  published: path.join(__dirname, 'public', 'snapshot'),

  view: '402',

  'ttl': _config.ttl || 10,

  'content': {
    baseUri: (_config.baseUrl || 'http://localhost:' + getPort())
               + '/snapshot',
  },

  'payment': [],

  'validity': 3600,
};

var modules = [];<commit_msg>--root option<commit_after>/* Basic SWM app */

var path = require('path');

var express = require('express');
var logger = require('morgan');

var debug = require('debug')('swim:app');

var swim = require('./');

function getRoot() {
  return process.argv[2] && process.argv[2].match(/^--root=/g)
      && process.argv[2].match(/^[^=]*=(.*)/)[1];
}

function getPort() {
  return process.env.PORT || 3000;
}

var _config = null;

try {
  _config = require(path.resolve(process.cwd(),
        process.env.CONFIG_FILE || 'config.json'));
} catch (error) {
  if (error.code === 'MODULE_NOT_FOUND') {
    console.error(process.env.CONFIG_FILE ? 'Config file not found'
        : 'No config.json available');
  } else {
    console.error('Invalid config');
  }
  process.exit(1);
}

var config = {
  root: getRoot() || _config.root || path.join(__dirname, 'content'),

  working:   path.join(__dirname, '.data'),
  published: path.join(__dirname, 'public', 'snapshot'),

  view: '402',

  'ttl': _config.ttl || 10,

  'content': {
    baseUri: (_config.baseUrl || 'http://localhost:' + getPort())
               + '/snapshot',
  },

  'payment': [],

  'validity': 3600,
};

var modules = [];
{'fraction_non_alphanumeric': 0.20311804008908685, 'fraction_numerical': 0.014699331848552339, 'mean_word_length': 3.4741035856573705, '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': '266566', 'n_tokens_mistral': 787, 'n_tokens_neox': 750, 'n_words': 165}