Remove internal sysadmin server
this is now unused
This commit is contained in:
@@ -23,7 +23,6 @@ var accesscontrol = require('./accesscontrol.js'),
|
||||
ws = require('ws');
|
||||
|
||||
var gHttpServer = null;
|
||||
var gSysadminHttpServer = null;
|
||||
|
||||
function initializeExpressSync() {
|
||||
var app = express();
|
||||
@@ -340,38 +339,6 @@ function initializeExpressSync() {
|
||||
return httpServer;
|
||||
}
|
||||
|
||||
// provides local webhooks for sysadmins
|
||||
function initializeSysadminExpressSync() {
|
||||
var app = express();
|
||||
var httpServer = http.createServer(app);
|
||||
|
||||
var QUERY_LIMIT = '1mb'; // max size for json and urlencoded queries
|
||||
var REQUEST_TIMEOUT = 10000; // timeout for all requests
|
||||
|
||||
var json = middleware.json({ strict: true, limit: QUERY_LIMIT }), // application/json
|
||||
urlencoded = middleware.urlencoded({ extended: false, limit: QUERY_LIMIT }); // application/x-www-form-urlencoded
|
||||
|
||||
if (process.env.BOX_ENV !== 'test') app.use(middleware.morgan('Box Sysadmin :method :url :status :response-time ms - :res[content-length]', { immediate: false }));
|
||||
|
||||
var router = new express.Router();
|
||||
router.del = router.delete; // amend router.del for readability further on
|
||||
|
||||
app
|
||||
.use(middleware.timeout(REQUEST_TIMEOUT))
|
||||
.use(json)
|
||||
.use(urlencoded)
|
||||
.use(router)
|
||||
.use(middleware.lastMile());
|
||||
|
||||
// Sysadmin routes
|
||||
router.post('/api/v1/backup', routes.sysadmin.backup);
|
||||
router.post('/api/v1/update', routes.sysadmin.update);
|
||||
router.post('/api/v1/retire', routes.sysadmin.retire);
|
||||
router.post('/api/v1/apps/:id/import', routes.sysadmin.importAppDatabase);
|
||||
|
||||
return httpServer;
|
||||
}
|
||||
|
||||
function start(callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
assert.strictEqual(gHttpServer, null, 'Server is already up and running.');
|
||||
@@ -379,7 +346,6 @@ function start(callback) {
|
||||
routes.oauth2.initialize(); // init's the oauth server
|
||||
|
||||
gHttpServer = initializeExpressSync();
|
||||
gSysadminHttpServer = initializeSysadminExpressSync();
|
||||
|
||||
async.series([
|
||||
routes.accesscontrol.initialize, // hooks up authentication strategies into passport
|
||||
@@ -387,7 +353,6 @@ function start(callback) {
|
||||
settings.initCache, // pre-load very often used settings
|
||||
cloudron.initialize,
|
||||
gHttpServer.listen.bind(gHttpServer, constants.PORT, '127.0.0.1'),
|
||||
gSysadminHttpServer.listen.bind(gSysadminHttpServer, constants.SYSADMIN_PORT, '127.0.0.1'),
|
||||
eventlog.add.bind(null, eventlog.ACTION_START, { userId: null, username: 'boot' }, { version: constants.VERSION })
|
||||
], callback);
|
||||
}
|
||||
@@ -402,14 +367,12 @@ function stop(callback) {
|
||||
database.uninitialize,
|
||||
routes.accesscontrol.uninitialize,
|
||||
gHttpServer.close.bind(gHttpServer),
|
||||
gSysadminHttpServer.close.bind(gSysadminHttpServer)
|
||||
], function (error) {
|
||||
if (error) return callback(error);
|
||||
|
||||
routes.oauth2.uninitialize();
|
||||
|
||||
gHttpServer = null;
|
||||
gSysadminHttpServer = null;
|
||||
|
||||
callback(null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user