aboutsummaryrefslogtreecommitdiffstats
path: root/deployment-handler.js
diff options
context:
space:
mode:
Diffstat (limited to 'deployment-handler.js')
-rw-r--r--deployment-handler.js29
1 files changed, 16 insertions, 13 deletions
diff --git a/deployment-handler.js b/deployment-handler.js
index 1d59733..2ae1391 100644
--- a/deployment-handler.js
+++ b/deployment-handler.js
@@ -1,5 +1,5 @@
/*
-Copyright(c) 2017 AT&T Intellectual Property. All rights reserved.
+Copyright(c) 2017-2018 AT&T Intellectual Property. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@ See the License for the specific language governing permissions and limitations
"use strict";
-const API_VERSION = "4.1.0";
+const API_VERSION = "4.3.0";
const fs = require('fs');
const util = require('util');
@@ -75,9 +75,10 @@ const start = function(config) {
"policy": POLICY_PATH,
"swagger-ui": SWAGGER_UI_PATH
};
- exports.config = config;
+ process.mainModule.exports.config = config;
- log.debug(null, "Configuration: " + JSON.stringify(config));
+ log.info(null, "Configuration: " + JSON.stringify(config));
+ console.log( (new Date()) + ": Configuration: " + JSON.stringify(config, undefined, 2) );
set_app();
@@ -103,7 +104,7 @@ const start = function(config) {
}
catch (e) {
throw (createError('Could not create http(s) server--exiting: '
- + e.message, 500, 'system', 551));
+ + (e.message || "") + " " + (e.stack || "").replace(/\n/g, " "), 500, 'system', 551));
}
server.setTimeout(0);
@@ -119,9 +120,11 @@ const start = function(config) {
/* Set up handling for terminate signal */
process.on('SIGTERM', function() {
var startTime = new Date();
- log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler API shutting down.")
+ log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler API shutting down.");
+ console.log( "startTime: " + startTime + ": Deployment Handler API shutting down." )
server.close(function() {
- log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler API server shut down.")
+ log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler API server shut down.");
+ console.log( "startTime: " + startTime + ": Deployment Handler API shutting down" )
});
});
@@ -134,7 +137,8 @@ const start = function(config) {
process.on('beforeExit', function() {
if (!loggedExit) {
loggedExit = true;
- log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler process exiting.")
+ log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler process exiting.");
+ console.log( "startTime: " + startTime + ": Deployment Handler process exiting." )
}
});
};
@@ -147,11 +151,10 @@ const log = logging.getLogger();
conf.configure()
.then(start)
.catch(function(e) {
- log.error(e.logCode ? e : createError(
- 'Deployment-handler exiting due to start-up problem: ' + e.message, 500,
- 'system', 552));
- console.error("Deployment-handler exiting due to startup problem: " + e.message);
+ const fatal_msg = 'Deployment-handler exiting due to start-up problem: ' + (e.message || "")
+ + " " + (e.stack || "").replace(/\n/g, " ");
+ log.error(e.logCode ? e : createError(fatal_msg, 500, 'system', 552));
+ console.error(fatal_msg);
});
module.exports.app = app;
-module.exports.set_app = set_app;