1 | "use strict";
|
2 |
|
3 | const _ = require('lodash');
|
4 |
|
5 | const fetchCmsMeta = require('./helpers/fetchCmsMeta');
|
6 |
|
7 | const startApp = require('./helpers/app');
|
8 |
|
9 | module.exports = async port => {
|
10 |
|
11 | const fetched = await fetchCmsMeta();
|
12 | const mapped = {};
|
13 | fetched.forEach(([map, jsonRpcResponse]) => {
|
14 | Object.keys(map).forEach(variableName => {
|
15 | const variableValue = _.get(jsonRpcResponse, ['result', ...map[variableName].split('.')]);
|
16 |
|
17 | mapped[variableName] = variableValue;
|
18 | });
|
19 | });
|
20 |
|
21 | const app = await startApp(mapped);
|
22 | return app.listen(port);
|
23 | }; |
\ | No newline at end of file |