generalization, updates

This commit is contained in:
AJ ONeal 2015-11-28 05:57:07 +00:00
parent 5a8f901bbe
commit 9bcee6ae99
2 changed files with 7 additions and 7 deletions

View File

@ -39,7 +39,7 @@ module.exports.create = function (opts) {
// Worker Mode // Worker Mode
// //
function waitForConfig(message) { function waitForConfig(message) {
if ('com.daplie.walnut.init' !== message.type) { if ('walnut.init' !== message.type) {
console.warn('[Worker] 0 got unexpected message:'); console.warn('[Worker] 0 got unexpected message:');
console.warn(message); console.warn(message);
return; return;
@ -59,7 +59,7 @@ module.exports.create = function (opts) {
} }
promiseApp = new PromiseA(function (resolve) { promiseApp = new PromiseA(function (resolve) {
function initWebServer(srvmsg) { function initWebServer(srvmsg) {
if ('com.daplie.walnut.webserver.onrequest' !== srvmsg.type) { if ('walnut.webserver.onrequest' !== srvmsg.type) {
console.warn('[Worker] 1 got unexpected message:'); console.warn('[Worker] 1 got unexpected message:');
console.warn(srvmsg); console.warn(srvmsg);
return; return;
@ -70,7 +70,7 @@ module.exports.create = function (opts) {
resolve(require('../lib/worker').create(webserver, srvmsg)); resolve(require('../lib/worker').create(webserver, srvmsg));
} }
process.send({ type: 'com.daplie.walnut.webserver.listening' }); process.send({ type: 'walnut.webserver.listening' });
process.on('message', initWebServer); process.on('message', initWebServer);
}).then(function (app) { }).then(function (app) {
console.info('[Worker Ready]'); console.info('[Worker Ready]');

View File

@ -15,7 +15,7 @@ module.exports.create = function (webserver, info, state) {
var models = {}; var models = {};
var systemFactory = require('sqlite3-cluster/client').createClientFactory({ var systemFactory = require('sqlite3-cluster/client').createClientFactory({
dirname: path.join(__dirname, '..', '..', 'var') // TODO info.conf dirname: path.join(__dirname, '..', '..', 'var') // TODO info.conf
, prefix: 'com.daplie.' , prefix: 'com.example.'
//, dbname: 'config' //, dbname: 'config'
, suffix: '' , suffix: ''
, ext: '.sqlite3' , ext: '.sqlite3'
@ -27,7 +27,7 @@ module.exports.create = function (webserver, info, state) {
, bits: 128 , bits: 128
, mode: 'cbc' , mode: 'cbc'
, dirname: path.join(__dirname, '..', '..', 'var') // TODO info.conf , dirname: path.join(__dirname, '..', '..', 'var') // TODO info.conf
, prefix: 'com.daplie.' , prefix: 'com.example.'
//, dbname: 'cluster' //, dbname: 'cluster'
, suffix: '' , suffix: ''
, ext: '.sqlcipher' , ext: '.sqlcipher'
@ -53,7 +53,7 @@ module.exports.create = function (webserver, info, state) {
return require('./lib/unlock-device').create().then(function (result) { return require('./lib/unlock-device').create().then(function (result) {
result.promise.then(function (_rootMasterKey) { result.promise.then(function (_rootMasterKey) {
process.send({ process.send({
type: 'com.daplie.walnut.keys.root' type: 'walnut.keys.root'
conf: { conf: {
rootMasterKey: _rootMasterkey rootMasterKey: _rootMasterkey
} }
@ -204,7 +204,7 @@ module.exports.create = function (webserver, info, state) {
if (/(^|\.)proxyable\./.test(req.hostname)) { if (/(^|\.)proxyable\./.test(req.hostname)) {
// device-id-12345678.proxyable.myapp.mydomain.com => myapp.mydomain.com // device-id-12345678.proxyable.myapp.mydomain.com => myapp.mydomain.com
// proxyable.myapp.mydomain.com => myapp.mydomain.com // proxyable.myapp.mydomain.com => myapp.mydomain.com
// TODO myapp.mydomain.com.daplieproxyable.com => myapp.mydomain.com // TODO myapp.mydomain.com.example.proxyable.com => myapp.mydomain.com
req.hostname = req.hostname.replace(/.*\.?proxyable\./, ''); req.hostname = req.hostname.replace(/.*\.?proxyable\./, '');
} }