<commit_before>var requestModule = require('request');
var express = require("express");
var moment = require("moment");
var url = require('url');
var swig = require('swig');
var path = require('path');
var _ = require("underscore");
var opbeat = require('opbeat');
var session = require("express-session");
var q = require('q');
var mongoDbConnection = require('./lib/connection.js');
var util = require('./util');
var PasswordEncrypt = require('./lib/PasswordEncrypt');
var redis = require('redis');
var RedisStore = require('connect-redis')(session);
var logger = require('morgan');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var fs = require('fs');
var validateRequest = require("./validateRequest");


var opbeatOptions = {
    organization_id: process.env.OPBEAT_ORGANIZATION_ID,
    app_id: process.env.OPBEAT_APP_ID,
    secret_token: process.env.OPBEAT_SECRET_TOKEN
};
var client = opbeat.createClient(opbeatOptions);

var app = express();

app.use(logger());
app.use(cookieParser());
var sessionSecret = process.env.SESSION_SECRET;
var redisURL = url.parse(process.env.REDISCLOUD_URL);
var redisClient = redis.createClient(redisURL.port, redisURL.hostname, {no_ready_check: true});
redisClient.auth(redisURL.auth.split(":")[1]);
app.set('trust proxy', 1);
app.use(session({
    store: new RedisStore({
        client: redisClient
    }),
    secret: sessionSecret,
    resave: false, // don't save session if unmodified
    saveUninitialized: false, // don't create session until something stored
    cookie: {
        maxAge: 2 * 365 * 24 * 60 * 60 * 1000, // 2 years
        secure: true // change to true when using https
    }
}));

app.use(bodyParser.urlencoded({
    extended: true
}));
app.use(bodyParser.json());

app.engine('html', swig.renderFile);
app.use(express.static(path.join(__dirname, 'website/public')));
app.set('views', __dirname + '/website/views');
app.set('view engine', 'html');
/* app.set('view cache', false);
 swig.setDefaults({
 cache: false
 });*/

// Constants
var aDay = 24 * 60 * 60 * 1000;
var platformUri = process.env.PLATFORM_BASE_URI;
var sharedSecret = process.env.SHARED_SECRET;<commit_msg>- trying another version<commit_after>var requestModule = require('request');
var express = require("express");
var moment = require("moment");
var url = require('url');
var swig = require('swig');
var path = require('path');
var _ = require("underscore");
var opbeat = require('opbeat');
var session = require("express-session");
var q = require('q');
var mongoDbConnection = require('./lib/connection.js');
var util = require('./util');
var PasswordEncrypt = require('./lib/PasswordEncrypt');
var redis = require('redis');
var RedisStore = require('connect-redis')(session);
var logger = require('morgan');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var fs = require('fs');
var validateRequest = require("./validateRequest");


var opbeatOptions = {
    organization_id: process.env.OPBEAT_ORGANIZATION_ID,
    app_id: process.env.OPBEAT_APP_ID,
    secret_token: process.env.OPBEAT_SECRET_TOKEN
};
var client = opbeat.createClient(opbeatOptions);

var app = express();

app.use(logger());
app.use(cookieParser());
var sessionSecret = process.env.SESSION_SECRET;
var redisURL = url.parse(process.env.REDISCLOUD_URL);
var redisClient = redis.createClient(redisURL.port, redisURL.hostname, {no_ready_check: true});
redisClient.auth(redisURL.auth.split(":")[1]);
app.set('trust proxy', 1);
app.use(session({
    store: new RedisStore({
        client: redisClient
    }),
    secret: sessionSecret,
    resave: false, // don't save session if unmodified
    saveUninitialized: false, // don't create session until something stored
    cookie: {
        maxAge: 2 * 365 * 24 * 60 * 60 * 1000, // 2 years
        secure: true, // change to true when using https
        httpOnly: false
    }
}));

app.use(bodyParser.urlencoded({
    extended: true
}));
app.use(bodyParser.json());

app.engine('html', swig.renderFile);
app.use(express.static(path.join(__dirname, 'website/public')));
app.set('views', __dirname + '/website/views');
app.set('view engine', 'html');
/* app.set('view cache', false);
 swig.setDefaults({
 cache: false
 });*/

// Constants
var aDay = 24 * 60 * 60 * 1000;
var platformUri = process.env.PLATFORM_BASE_URI;
var sharedSecret = process.env.SHARED_SECRET;
{'fraction_non_alphanumeric': 0.1615174920490686, 'fraction_numerical': 0.01226715129486597, 'mean_word_length': 4.925975773889637, 'pattern_counts': {'":': 2, '<': 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': '6548081', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1390, 'n_words': 334}