forked from harshjv/ethereum-scraper
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (30 loc) · 713 Bytes
/
index.js
File metadata and controls
35 lines (30 loc) · 713 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
29
30
31
32
33
34
35
const Sentry = require('@sentry/node')
if (process.env.NODE_ENV === 'production') {
if (process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN
})
}
} else {
require('dotenv').config()
}
const {
MONGO_URI,
WEB3_URI,
PROCESS_TYPE
} = process.env
if (!MONGO_URI) throw new Error('Invalid MONGO_URI')
if (!WEB3_URI) throw new Error('Invalid WEB3_URI')
const mongoose = require('mongoose')
mongoose.connect(MONGO_URI, { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true })
switch (PROCESS_TYPE) {
case 'api':
require('./api')
break
case 'scraper':
require('./scraper')
break
default:
require('./api')
require('./scraper')
}