diff options
author | Alex Shatov <alexs@att.com> | 2017-09-28 09:20:14 -0400 |
---|---|---|
committer | Alex Shatov <alexs@att.com> | 2017-09-28 09:20:14 -0400 |
commit | 944b946e05a0e0acbcfc29b15e53dc76e7b05581 (patch) | |
tree | b96c5e003b21957411454b37d208bc8b60341e8b /deployment-handler.js | |
parent | a2ffa33f55ae178e91df119aa19d2bede35d083f (diff) |
4.2.2. fixed starting up of deployment-handler
* start of dh was broken by coding for unit-test
* Coverage summary
Statements : 50.84% ( 514/1011 )
Branches : 26.11% ( 100/383 )
Functions : 30.11% ( 56/186 )
Lines : 51.35% ( 513/999 )
Change-Id: Ibb59f1ddd25a37a7bd58f4017837a622b04381e3
Issue-Id: DCAEGEN2-62
Signed-off-by: Alex Shatov <alexs@att.com>
Diffstat (limited to 'deployment-handler.js')
-rw-r--r-- | deployment-handler.js | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/deployment-handler.js b/deployment-handler.js index 171f73c..1d59733 100644 --- a/deployment-handler.js +++ b/deployment-handler.js @@ -36,24 +36,26 @@ const SWAGGER_UI_PATH = "/swagger-ui"; const app = express(); -/* Set up the application */ -app.set('x-powered-by', false); -app.set('etag', false); +const set_app = function() { + /* Set up the application */ + app.set('x-powered-by', false); + app.set('etag', false); -/* Give each request a unique request ID */ -app.use(require('./lib/middleware').assignId); + /* Give each request a unique request ID */ + app.use(require('./lib/middleware').assignId); -/* If authentication is set up, check it */ -app.use(require('./lib/auth').checkAuth); + /* If authentication is set up, check it */ + app.use(require('./lib/auth').checkAuth); -/* Set up API routes */ -app.use(INFO_PATH, require('./lib/info')); -app.use(DEPLOYMENTS_PATH, require('./lib/dcae-deployments')); -app.use(POLICY_PATH, require('./lib/policy')); -app.use(SWAGGER_UI_PATH, require('./lib/swagger-ui')); + /* Set up API routes */ + app.use(INFO_PATH, require('./lib/info')); + app.use(DEPLOYMENTS_PATH, require('./lib/dcae-deployments')); + app.use(POLICY_PATH, require('./lib/policy')); + app.use(SWAGGER_UI_PATH, require('./lib/swagger-ui')); -/* Set up error handling */ -app.use(require('./lib/middleware').handleErrors); + /* Set up error handling */ + app.use(require('./lib/middleware').handleErrors); +} const start = function(config) { @@ -77,6 +79,8 @@ const start = function(config) { log.debug(null, "Configuration: " + JSON.stringify(config)); + set_app(); + /* Start the server */ var server = null; var usingTLS = false; @@ -149,4 +153,5 @@ conf.configure() console.error("Deployment-handler exiting due to startup problem: " + e.message); }); -module.exports = app;
\ No newline at end of file +module.exports.app = app; +module.exports.set_app = set_app; |