goldilocks.js/lib/worker.js

26 lines
732 B
JavaScript
Raw Normal View History

'use strict';
// TODO needs some sort of config-sync
process.on('message', function (conf) {
var deps = {
messenger: process
2017-05-10 16:05:54 -06:00
// Note that if a custom createConnections is used it will be called with different
// sets of custom options based on what is actually being proxied. Most notably the
// HTTP proxying connection creation is not something we currently control.
2017-04-27 16:05:34 -06:00
, net: require('net')
};
2017-05-17 14:06:24 -06:00
deps.proxy = require('./proxy-conn').create(deps, conf);
2017-06-09 11:18:05 -06:00
deps.storage = {
config: {
save: function (changes) {
process.send({
type: 'com.daplie.goldilocks.config-change',
changes: changes
});
}
}
};
2017-05-17 14:06:24 -06:00
require('./goldilocks.js').create(deps, conf);
});