merge oauthproxy server into box server
This commit is contained in:
@@ -8,6 +8,7 @@ var appHealthMonitor = require('./src/apphealthmonitor.js'),
|
|||||||
async = require('async'),
|
async = require('async'),
|
||||||
config = require('./src/config.js'),
|
config = require('./src/config.js'),
|
||||||
ldap = require('./src/ldap.js'),
|
ldap = require('./src/ldap.js'),
|
||||||
|
oauthproxy = require('./src/oauthproxy.js'),
|
||||||
server = require('./src/server.js');
|
server = require('./src/server.js');
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
@@ -28,7 +29,8 @@ console.log();
|
|||||||
async.series([
|
async.series([
|
||||||
server.start,
|
server.start,
|
||||||
ldap.start,
|
ldap.start,
|
||||||
appHealthMonitor.start
|
appHealthMonitor.start,
|
||||||
|
oauthproxy.start.bind(null, 4000 /* port */)
|
||||||
], function (error) {
|
], function (error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('Error starting server', error);
|
console.error('Error starting server', error);
|
||||||
@@ -41,11 +43,13 @@ var NOOP_CALLBACK = function () { };
|
|||||||
process.on('SIGINT', function () {
|
process.on('SIGINT', function () {
|
||||||
server.stop(NOOP_CALLBACK);
|
server.stop(NOOP_CALLBACK);
|
||||||
ldap.stop(NOOP_CALLBACK);
|
ldap.stop(NOOP_CALLBACK);
|
||||||
|
oauthproxy.stop(NOOP_CALLBACK);
|
||||||
setTimeout(process.exit.bind(process), 3000);
|
setTimeout(process.exit.bind(process), 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('SIGTERM', function () {
|
process.on('SIGTERM', function () {
|
||||||
server.stop(NOOP_CALLBACK);
|
server.stop(NOOP_CALLBACK);
|
||||||
ldap.stop(NOOP_CALLBACK);
|
ldap.stop(NOOP_CALLBACK);
|
||||||
|
oauthproxy.stop(NOOP_CALLBACK);
|
||||||
setTimeout(process.exit.bind(process), 3000);
|
setTimeout(process.exit.bind(process), 3000);
|
||||||
});
|
});
|
||||||
|
|||||||
Executable → Regular
+9
-14
@@ -1,15 +1,16 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
exports = module.exports = {
|
||||||
|
start: start,
|
||||||
|
stop: stop
|
||||||
|
};
|
||||||
|
|
||||||
require('supererror')({ splatchError: true });
|
require('supererror')({ splatchError: true });
|
||||||
|
|
||||||
var appdb = require('./src/appdb.js'),
|
var appdb = require('./src/appdb.js'),
|
||||||
assert = require('assert'),
|
assert = require('assert'),
|
||||||
async = require('async'),
|
|
||||||
clientdb = require('./src/clientdb.js'),
|
clientdb = require('./src/clientdb.js'),
|
||||||
config = require('./src/config.js'),
|
config = require('./src/config.js'),
|
||||||
database = require('./src/database.js'),
|
|
||||||
debug = require('debug')('box:proxy'),
|
debug = require('debug')('box:proxy'),
|
||||||
express = require('express'),
|
express = require('express'),
|
||||||
http = require('http'),
|
http = require('http'),
|
||||||
@@ -182,14 +183,8 @@ function start(port, callback) {
|
|||||||
gHttpServer.listen(port, callback);
|
gHttpServer.listen(port, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
async.series([
|
function stop(callback) {
|
||||||
database.initialize,
|
assert.strictEqual(typeof callback, 'function');
|
||||||
start.bind(null, 3000)
|
|
||||||
], function (error) {
|
|
||||||
if (error) {
|
|
||||||
console.error('Failed to start proxy server.', error);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Proxy server listening...');
|
gHttpServer.close(callback);
|
||||||
});
|
}
|
||||||
Reference in New Issue
Block a user