<commit_before>// ---------------------------------------

if (require.main !== module)
	throw (new Error ());

// ---------------------------------------

var _ = require ("underscore");
var dust = require ("dust");
var express = require ("express");
var path = require ("path");

var views = require ("./views");

var configuration = require ("./configuration");
var transcript = require ("./transcript") (module, configuration.mainTranscriptLevel);

// ---------------------------------------

function _main ()
{
	if (process.argv.length != 2) {
		transcript.traceError ("invalid arguments; aborting!");
		process.exit (1);
		return;
	}
	
	if (process.env["mosaic_node_ip"] !== undefined)
		configuration.nodeIp = process.env["mosaic_node_ip"];
	if (process.env["mosaic_node_port"] !== undefined)
		configuration.nodePort = process.env["moasic_node_port"];
	
	if (process.env["mosaic_node_wui_ip"] !== undefined)
		configuration.serverIp = process.env["mosaic_node_wui_ip"];
	if (process.env["mosaic_node_wui_port"] !== undefined)
		configuration.serverPort = process.env["mosaic_node_wui_port"];
	
	process.stdin.on ("data", function (_data) {
		transcript.traceError ("unexpected data received on stdin; aborting!");
		process.exit (1);
	});
	process.stdin.on ("end", function () {
		transcript.traceInformation ("input stream closed; exiting!");
		process.exit (0);
	});
	process.stdin.resume ();
	
	var _application = express.createServer ();
	
	_application.configure (function () {
		views.configureApplication (_application);
	});
	
	transcript.traceInformation ("starting web server on `http://%s:%d/`...", configuration.serverIp, configuration.serverPort);
	_application.listen (configuration.serverPort, configuration.serverIp);
}

// ---------------------------------------

dust.filters.json = function (_value) {
	return (JSON.stringify (_value));
};
dust.filters.jsonp = function (_value) {
	return (JSON.stringify (_value, null, 4));
};
dust.filters.htmlpre = function (_value) {
	return (_value.replace (/</g, "&lt;") .replace (/>/g, "&gt;"));
};
dust.filters.insa = function (_value) {
	return (_value.replace (/((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)/g, "<a href='$1'>$1</a>"));
};

// ---------------------------------------

_main ();

// ---------------------------------------
<commit_msg>Minor updates.<commit_after>// ---------------------------------------

if (require.main !== module)
	throw (new Error ());

// ---------------------------------------

var _ = require ("underscore");
var dust = require ("dust");
var express = require ("express");
var path = require ("path");

var views = require ("./views");

var configuration = require ("./configuration");
var transcript = require ("./transcript") (module, configuration.mainTranscriptLevel);

// ---------------------------------------

function _main ()
{
	if (process.argv.length != 2) {
		transcript.traceError ("invalid arguments; aborting!");
		process.exit (1);
		return;
	}
	
	if (process.env["mosaic_node_ip"] !== undefined)
		configuration.nodeIp = process.env["mosaic_node_ip"];
	if (process.env["mosaic_node_port"] !== undefined)
		configuration.nodePort = parseInt (process.env["mosaic_node_port"]);
	
	if (process.env["mosaic_node_wui_ip"] !== undefined)
		configuration.serverIp = process.env["mosaic_node_wui_ip"];
	if (process.env["mosaic_node_wui_port"] !== undefined)
		configuration.serverPort = parseInt (process.env["mosaic_node_wui_port"]);
	
	process.stdin.on ("data", function (_data) {
		transcript.traceError ("unexpected data received on stdin; aborting!");
		process.exit (1);
	});
	process.stdin.on ("end", function () {
		transcript.traceInformation ("input stream closed; exiting!");
		process.exit (0);
	});
	process.stdin.resume ();
	
	var _application = express.createServer ();
	
	_application.configure (function () {
		views.configureApplication (_application);
	});
	
	transcript.traceInformation ("starting web server on `http://%s:%d/`...", configuration.serverIp, configuration.serverPort);
	_application.listen (configuration.serverPort, configuration.serverIp);
}

// ---------------------------------------

dust.filters.json = function (_value) {
	return (JSON.stringify (_value));
};
dust.filters.jsonp = function (_value) {
	return (JSON.stringify (_value, null, 4));
};
dust.filters.htmlpre = function (_value) {
	return (_value.replace (/</g, "&lt;") .replace (/>/g, "&gt;"));
};
dust.filters.insa = function (_value) {
	return (_value.replace (/((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)/g, "<a href='$1'>$1</a>"));
};

// ---------------------------------------

_main ();

// ---------------------------------------

{'fraction_non_alphanumeric': 0.28370136698212406, 'fraction_numerical': 0.0029442691903259727, 'mean_word_length': 2.876120619396903, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1017091', 'n_tokens_mistral': 1515, 'n_tokens_neox': 1412, 'n_words': 289}