1 | 'use strict';
|
2 |
|
3 |
|
4 | require.main.paths.unshift(process.cwd() + '/node_modules');
|
5 |
|
6 |
|
7 | const boot = require.main.require('@fragmento/server-hapi');
|
8 |
|
9 |
|
10 | ;
|
11 | (async() => {
|
12 |
|
13 | try {
|
14 | console.log('[server-hapi] starting ...');
|
15 | let server = await boot(process.cwd());
|
16 | console.log('[server-hapi] ready\n', server.info);
|
17 |
|
18 |
|
19 |
|
20 | process.once('SIGUSR2', async function() {
|
21 | console.log('[server-hapi] stopping ...');
|
22 | await server.stop();
|
23 |
|
24 | console.log('[server-hapi] stopped');
|
25 | process.kill(process.pid, 'SIGUSR2');
|
26 | });
|
27 | } catch (e) {
|
28 | console.log('retry', e)
|
29 | process.exit(1);
|
30 | }
|
31 |
|
32 | })();
|