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

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

    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
    341x
    1x

    1x
    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,
      };

      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;
    };