<commit_before>var express     = require('express'),
    connect     = require('connect'),
    http        = require('http'),
    path        = require('path'),
    try{
    locals      = require('./config/locals'),
    }
    except(e) {//y 
    locals=null;}
    key         = process.env.KEY || locals.KEY,
    secret      = process.env.SECRET || locals.SECRET,
    cookieParser = express.cookieParser,
    sessionStore = new connect.middleware.session.MemoryStore(),
    app         = express(),
    mongoose    = require('mongoose'),
    passport    = require('passport'),
    flash       = require('connect-flash'),
    configDB    = process.env.MONGO_URL || locals.MONGO_URL;


// configuration ===============================================================
mongoose.connect(configDB); // connect to our database

require('./config/passport')(passport); // pass passport for configuration

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
//app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(cookieParser(secret));
app.use(express.session({
  store:  sessionStore,
  key:    key
}));
app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions
app.use(flash()); // use connect-flash for flash messages stored in session
app.use(express.static(path.join(__dirname, 'public')));
app.use(app.router);
// development only
if ('development' == app.get('env')) {
    app.use(express.errorHandler());
}

// routes ======================================================================
// load routes and pass in app and fully configured passport
require('./routes.js')(app, passport); 

// Spin up http server =========================================================
var server = http.createServer(app).listen(app.get('port'), function() {
    console.log('Express server listening on port ' + app.get('port'));
});
// Start up socket server ======================================================
var chatServer = require('./lib/chat_server');
chatServer.listen(server, sessionStore, cookieParser, passport, key, secret);
<commit_msg>Update locals handling<commit_after>var express     = require('express'),
    connect     = require('connect'),
    http        = require('http'),
    path        = require('path'),
    key         = process.env.KEY || locals.KEY,
    secret      = process.env.SECRET || locals.SECRET,
    cookieParser = express.cookieParser,
    sessionStore = new connect.middleware.session.MemoryStore(),
    app         = express(),
    mongoose    = require('mongoose'),
    passport    = require('passport'),
    flash       = require('connect-flash'),
    configDB    = process.env.MONGO_URL || locals.MONGO_URL,
    locals;
    try {
        locals = require('./config/locals'),
    }
    except(e) {
        locals=null;
    }

// configuration ===============================================================
mongoose.connect(configDB); // connect to our database

require('./config/passport')(passport); // pass passport for configuration

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
//app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(cookieParser(secret));
app.use(express.session({
  store:  sessionStore,
  key:    key
}));
app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions
app.use(flash()); // use connect-flash for flash messages stored in session
app.use(express.static(path.join(__dirname, 'public')));
app.use(app.router);
// development only
if ('development' == app.get('env')) {
    app.use(express.errorHandler());
}

// routes ======================================================================
// load routes and pass in app and fully configured passport
require('./routes.js')(app, passport); 

// Spin up http server =========================================================
var server = http.createServer(app).listen(app.get('port'), function() {
    console.log('Express server listening on port ' + app.get('port'));
});
// Start up socket server ======================================================
var chatServer = require('./lib/chat_server');
chatServer.listen(server, sessionStore, cookieParser, passport, key, secret);

{'fraction_non_alphanumeric': 0.25773195876288657, 'fraction_numerical': 0.001754770783066462, 'mean_word_length': 4.29616724738676, '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': '5018698', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1219, 'n_words': 268}