forked from makerdao/gov-polling-db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repl.js
31 lines (26 loc) · 828 Bytes
/
repl.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
const repl = require('repl');
const {
loadConfig,
mergeConfig,
} = require('@makerdao-dux/spock-etl/dist/services/configUtils');
const {
createServices,
} = require('@makerdao-dux/spock-etl/dist/services/services');
const { withConnection } = require('@makerdao-dux/spock-etl/dist/db/db');
async function main(connection) {
const config = mergeConfig(loadConfig('./config.js'));
const services = await createServices(config);
return withConnection(services.db, (connection) => {
const r = repl.start();
Object.assign(r.context, {
services,
config,
mbt: config.transformers.find((x) => x.name === 'MKR_BalanceTransformer'),
cbt: config.transformers.find(
(x) => x.name === 'ChiefBalanceTransformer'
),
});
r.on('exit', () => process.exit());
});
}
main();