-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (21 loc) · 820 Bytes
/
Copy pathindex.js
File metadata and controls
28 lines (21 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict';
const governify = require('governify-commons');
const logger = governify.getLogger().tag('controller-tasks');
const server = require('./server');
const env = process.env.NODE_ENV ? process.env.NODE_ENV : 'production';
governify.init().then(commonsMiddleware => {
server.deploy(env, commonsMiddleware).catch(err => { logger.info(err); });
});
// quit on ctrl-c when running docker in terminal
process.on('SIGINT', function onSigint () {
logger.info('Got SIGINT (aka ctrl-c in docker). Graceful shutdown ', new Date().toISOString());
shutdown();
});
// quit properly on docker stop
process.on('SIGTERM', function onSigterm () {
logger.info('Got SIGTERM (docker container stop). Graceful shutdown ', new Date().toISOString());
shutdown();
});
const shutdown = () => {
server.undeploy();
};