# All files / src/api/methods getConfig.js

100% Statements 13/13
100% Branches 4/4
100% Functions 1/1
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    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
    353x
    3x

    3x
    3x

    3x

    3x

    3x

    3x
    2x

    3x
    3x
    3x

    3x

     const fs = require('fs');
    const { promisify } = require('util');

    module.exports = async (bridgeState, app) => {
      const readFile = promisify(fs.readFile);

      const config = {
        exitHandlerAddr: bridgeState.config.exitHandlerAddr,
        bridgeAddr: bridgeState.config.bridgeAddr,
        operatorAddr: bridgeState.config.operatorAddr,
        rootNetwork: bridgeState.config.rootNetwork,
        rootNetworkId: bridgeState.config.rootNetworkId,
        network: bridgeState.config.network,
        networkId: bridgeState.config.networkId,
        eventsDelay: bridgeState.config.eventsDelay,
        bridgeDelay: bridgeState.config.bridgeDelay,
        version: `v${require('../../../package.json').version}`, // eslint-disable-line
      };

      const genesis =
        bridgeState.config.genesis ||
        JSON.parse(await readFile(app.info().genesisPath));
      config.genesis = genesis;

      if (bridgeState.config.peers) {
        config.peers = bridgeState.config.peers;
      }

      const status = await app.status();
      config.p2pPort = app.info().p2pPort;
      config.nodeId = status.node_info.id;

      return config;
    };