forked from Brightscout/mattermost-etl
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
49 lines (46 loc) · 763 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
37
38
39
40
41
42
43
44
45
46
47
48
49
const context = require('./context')
const log = require('./lib/log')
const {
start,
version,
team,
channels,
users,
posts,
directChannels,
directPosts,
end
} = require('./lib/modules')
//
// Common function log errors and
// terminate the process
//
const abort = function(err) {
log.error(err)
//
// We set a timeout here to
// allow the log streams to finish
// writing.
//
setTimeout(function() {
process.exit(1)
}, 3000)
}
//
// Ensure we trap uncaught exceptions
// and properly abort
//
process.on('uncaughtException', abort)
//
// Let's do it
//
start(context)
.then(version)
.then(team)
.then(channels)
.then(users)
.then(posts)
.then(directChannels)
.then(directPosts)
.then(end)
.catch(abort)