From b8c717d24f26c81e0f75a4731f4dbf63d9a47a47 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Fri, 9 Apr 2021 12:23:34 -0700 Subject: [PATCH] fix(config): Adding env var for signaling circuit relay --- config/env/common.js | 12 +++++++++++- src/lib/ipfs.js | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/config/env/common.js b/config/env/common.js index 3ffae82..472a8c8 100644 --- a/config/env/common.js +++ b/config/env/common.js @@ -3,10 +3,20 @@ environments. */ +/* eslint no-unneeded-ternary:0 */ + module.exports = { + // Configure TCP port. port: process.env.PORT || 5001, + + // Password for HTML UI that displays logs. logPass: 'test', + + // Email server settings if nodemailer email notifications are used. emailServer: process.env.EMAILSERVER ? process.env.EMAILSERVER : 'mail.someserver.com', emailUser: process.env.EMAILUSER ? process.env.EMAILUSER : 'noreply@someserver.com', - emailPassword: process.env.EMAILPASS ? process.env.EMAILPASS : 'emailpassword' + emailPassword: process.env.EMAILPASS ? process.env.EMAILPASS : 'emailpassword', + + // IPFS settings. + isCircuitRelay: process.env.ENABLE_CIRCUIT_RELAY ? true : false } diff --git a/src/lib/ipfs.js b/src/lib/ipfs.js index cfbfd3e..5429d7b 100644 --- a/src/lib/ipfs.js +++ b/src/lib/ipfs.js @@ -10,6 +10,7 @@ const IpfsCoord = require('ipfs-coord') const BCHJS = require('@psf/bch-js') // Local libraries +const config = require('../../config') const JSONRPC = require('../rpc') class IPFSLib { @@ -19,6 +20,7 @@ class IPFSLib { this.IpfsCoord = IpfsCoord this.bchjs = new BCHJS() this.rpc = new JSONRPC() + this.config = config // this.rpc = {} // if (localConfig.rpc) { @@ -81,7 +83,8 @@ class IPFSLib { ipfs: this.ipfs, type: 'node.js', bchjs: this.bchjs, - privateLog: this.rpc.router + privateLog: this.rpc.router, + isCircuitRelay: this.config.isCircuitRelay }) await this.ipfsCoord.isReady()