forked from RackHD/on-tftp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (32 loc) · 820 Bytes
/
index.js
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
29
30
31
32
33
34
35
36
// Copyright 2015, EMC, Inc.
"use strict";
var di = require('di'),
_ = require('lodash'),
core = require('on-core')(di),
injector = new di.Injector(
_.flatten([
core.injectables,
require('./lib/app'),
require('./lib/server')
])
),
logger = injector.get('Logger').initialize('Tftp'),
tftp = injector.get('Tftp');
tftp.start()
.catch(function(err) {
logger.critical('Failure starting TFTP service' + err.stack);
process.nextTick(function(){
process.exit(1);
});
});
process.on('SIGINT',function() {
tftp.stop()
.catch(function(err) {
logger.critical('Failure cleaning up TFTP service' + err.stack);
})
.finally(function() {
process.nextTick(function(){
process.exit(1);
});
});
});