Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mixdown-server

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mixdown-server - npm Package Compare versions

Comparing version 0.2.4 to 0.3.3

lib/main.js

1

index.js

@@ -7,3 +7,4 @@ var mixdown = {};

mixdown.Logger = require('./lib/logger');
mixdown.MainFactory = require('./lib/main');
module.exports = mixdown;

1

lib/app.js

@@ -34,3 +34,2 @@ var util = require('util'),

if (path) {
try {

@@ -37,0 +36,0 @@ Mod = require(path);

var _ = require('lodash'),
winston = require('winston'),
syslog = require('winston-syslog');
winston = require('winston');
require('winston-syslog');
// Until this is fixed, attaching to global logger seems to be only option.
// https://github.com/indexzero/winston-syslog/issues/7
module.exports.create = function(options) {
var logger = null;
var logger = winston;
if (options) {
if (options) {
// create array of transports from config.
var transports = _.map(options.transports, function(transport) {
// create array of transports from config.
var transports = _.map(options.transports, function(transport) {
var opt = _.defaults(transport.options, options.defaults);
logger.add(winston.transports[transport.transport], opt);
});
var opt = _.defaults(transport.options, options.defaults);
return new (winston.transports[transport.transport])({
handleExceptions: opt.handleExceptions,
json: opt.json,
timestamp: opt.timestamp,
colorize: opt.colorize
});
});
// set levels
logger.setLevels(winston.config.syslog.levels);
}
// create logger instance
logger = new (winston.Logger)({
exitOnError: false,
transports: transports
});
// set levels
logger.setLevels(winston.config.syslog.levels);
}
return logger;
return logger;
};
var _ = require('lodash'),
http = require('http');
fs = require('fs'),
http = require('http'),
cluster = require('cluster');

@@ -24,23 +26,23 @@ module.exports = function(serverConfig) {

try {
// Create the main server
var vhosts = {};
// Create the main server
var vhosts = {};
// Loop over cobrands and add all of the apps by hostnames so that express can do the mapping automatically.
_.each(serverConfig.apps, function(app) {
// Loop over cobrands and add all of the apps by hostnames so that express can do the mapping automatically.
_.each(serverConfig.apps, function(app) {
// logger.info(siteConfig.hostmap);
// consider moving the logger stuff to event emitters
// logger.info(siteConfig.hostmap);
// consider moving the logger stuff to event emitters
_.each(app.config.hostmap, function(host) {
vhosts[host] = app;
});
_.each(app.config.hostmap, function(host) {
vhosts[host] = app;
});
});
// Set port from server config.
var port = serverConfig.server.port || 8080;
// Set port from server config.
var listen = serverConfig.server.listen || {},
lp = listen.type === 'unix' ? listen.path : listen.port;
http.createServer(function (req, res) {
var create = function() {
var socket = http.createServer(function (req, res) {
var host = req.headers.host.replace(/:\d+/, ''),

@@ -57,10 +59,14 @@ app = vhosts[host];

}).listen(port);
}).listen(lp, function(err) {
callback(err, { socket: socket });
});
};
// remove old file descriptor if needed.
if (listen.type === 'unix') {
fs.unlink(lp, create);
}
catch (err) {
callback(err);
return;
else {
create();
}
callback();
};

@@ -67,0 +73,0 @@ };

{
"name": "mixdown-server",
"version": "0.2.4",
"version": "0.3.3",
"main": "index",

@@ -28,7 +28,8 @@ "description": "Simple server for activiting a site.",

"scripts": {
"test": "node tests/example.js"
"test": "node tests/main.js"
},
"dependencies": {
"lodash": "0.9.1",
"lodash": "0.10.0",
"broadway": "0.2.5",
"optimist": "0.3.4",
"winston": "0.6.2",

@@ -35,0 +36,0 @@ "winston-syslog": "0.2.2"

var _ = require('lodash'),
VastLogger = require('../lib/logger'),
mixdownLogger = require('../lib/logger'),
tap = require('tap'),
test = tap.test;
global.logger = VastLogger.create({
global.logger = mixdownLogger.create({
"defaults": {

@@ -8,0 +8,0 @@ "handleExceptions": false,

@@ -43,4 +43,24 @@ {

"server": {
"port": 8080
"listen": {
"port": "8080"
},
"cluster": {
"on": true,
"workers": 2
},
"logger": {
"defaults": {
"handleExceptions": false,
"json": false,
"timestamp": true,
"colorize": true
},
"transports": [{
"transport": "Console",
"options": {
"handleExceptions": true
}
}]
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc