mirror of
https://github.com/openstf/stf
synced 2025-10-05 19:42:01 +02:00
Gracefully shutdown auth apps.
This commit is contained in:
parent
4ba11eca61
commit
609e33837b
2 changed files with 22 additions and 2 deletions
|
@ -1,15 +1,25 @@
|
|||
var http = require('http')
|
||||
|
||||
var express = require('express')
|
||||
var validator = require('express-validator')
|
||||
var Promise = require('bluebird')
|
||||
|
||||
var logger = require('../../util/logger')
|
||||
var requtil = require('../../util/requtil')
|
||||
var jwtutil = require('../../util/jwtutil')
|
||||
var pathutil = require('../../util/pathutil')
|
||||
var urlutil = require('../../util/urlutil')
|
||||
var lifecycle = require('../../util/lifecycle')
|
||||
|
||||
module.exports = function(options) {
|
||||
var log = logger.createLogger('auth-mock')
|
||||
, app = express()
|
||||
, server = Promise.promisifyAll(http.createServer(app))
|
||||
|
||||
lifecycle.observe(function() {
|
||||
log.info('Waiting for client connections to end')
|
||||
return server.closeAsync()
|
||||
})
|
||||
|
||||
app.set('view engine', 'jade')
|
||||
app.set('views', pathutil.resource('auth-mock/views'))
|
||||
|
@ -101,6 +111,6 @@ module.exports = function(options) {
|
|||
}
|
||||
})
|
||||
|
||||
app.listen(options.port)
|
||||
server.listen(options.port)
|
||||
log.info('Listening on port %d', options.port)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue