fix(upstream): Synced with upstream ipfs-service-provider

This commit is contained in:
Chris Troutner
2021-08-27 16:21:17 -07:00
9 changed files with 2933 additions and 9033 deletions
+7 -1
View File
@@ -47,6 +47,9 @@ class Server {
useNewUrlParser: true useNewUrlParser: true
}) })
console.log(`Starting environment: ${config.env}`)
console.log(`Debug level: ${config.debugLevel}`)
// MIDDLEWARE START // MIDDLEWARE START
app.use(convert(logger())) app.use(convert(logger()))
@@ -68,7 +71,7 @@ class Server {
// Attach REST API and JSON RPC controllers to the app. // Attach REST API and JSON RPC controllers to the app.
const Controllers = require('../src/controllers') const Controllers = require('../src/controllers')
const controllers = new Controllers() const controllers = new Controllers()
await controllers.attachControllers(app) await controllers.attachRESTControllers(app)
app.controllers = controllers app.controllers = controllers
@@ -94,6 +97,9 @@ class Server {
) )
} }
// Attach the other IPFS controllers
await controllers.attachControllers(app)
return app return app
} catch (err) { } catch (err) {
console.error('Could not start server. Error: ', err) console.error('Could not start server. Error: ', err)
+3 -1
View File
@@ -76,5 +76,7 @@ module.exports = {
ipfsWsPort: process.env.IPFS_WS_PORT ? process.env.IPFS_WS_PORT : 5669, ipfsWsPort: process.env.IPFS_WS_PORT ? process.env.IPFS_WS_PORT : 5669,
// BCH Mnemonic for generating encryption keys and payment address // BCH Mnemonic for generating encryption keys and payment address
mnemonic: process.env.MNEMONIC ? process.env.MNEMONIC : '' mnemonic: process.env.MNEMONIC ? process.env.MNEMONIC : '',
debugLevel: process.env.DEBUG_LEVEL ? parseInt(process.env.DEBUG_LEVEL) : 2
} }
+2894 -9019
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "ipfs-bch-wallet-service", "name": "ipfs-bch-wallet-service",
"version": "1.11.1", "version": "1.11.3",
"description": "IPFS and REST service providing blockchain access needed by a wallet. ", "description": "IPFS and REST service providing blockchain access needed by a wallet. ",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@@ -28,7 +28,7 @@
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"glob": "^7.1.6", "glob": "^7.1.6",
"ipfs": "0.55.4", "ipfs": "0.55.4",
"ipfs-coord": "^6.1.6", "ipfs-coord": "^6.4.0",
"jsonrpc-lite": "^2.2.0", "jsonrpc-lite": "^2.2.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"jwt-bch-lib": "^1.3.0", "jwt-bch-lib": "^1.3.0",
+2 -2
View File
@@ -23,7 +23,7 @@ WORKDIR /home/safeuser
#RUN runuser -l safeuser -c "npm config set prefix '~/.npm-global'" #RUN runuser -l safeuser -c "npm config set prefix '~/.npm-global'"
# Switch to user account. # Switch to user account.
USER safeuser #USER safeuser
# Prep 'sudo' commands. # Prep 'sudo' commands.
#RUN echo 'abcd8765' | sudo -S pwd #RUN echo 'abcd8765' | sudo -S pwd
@@ -39,7 +39,7 @@ WORKDIR /home/safeuser/ipfs-bch-wallet-service
RUN git checkout ct-unstable RUN git checkout ct-unstable
# Install dependencies # Install dependencies
RUN npm install -g node-pre-gyp RUN npm install -g @mapbox/node-pre-gyp
RUN npm install RUN npm install
# Generate the API docs # Generate the API docs
+1 -1
View File
@@ -22,7 +22,7 @@ bch-wallet-service:
- '5668:5668' # IPFS TCP Port - '5668:5668' # IPFS TCP Port
- '5669:5669' # IPFS WS Port - '5669:5669' # IPFS WS Port
volumes: volumes:
- ../.ipfsdata:/home/safeuser/.ipfsdata - ./data/.ipfsdata:/home/safeuser/ipfs-service-provider/.ipfsdata
# - ../orbitdb:/home/safeuser/orbitdb # - ../orbitdb:/home/safeuser/orbitdb
restart: always restart: always
+21 -5
View File
@@ -1,5 +1,26 @@
#!/bin/bash #!/bin/bash
# BEGIN: Optional configuration settings
# This mnemonic is used to set up persistent public key for e2ee
# Replace this with your own 12-word mnemonic.
export MNEMONIC="olive two muscle bottom coral ancient wait legend bronze useful process session"
# The human readable name this IPFS node identifies as.
export COORD_NAME=ipfs-service-provider-generic
# Allow this node to function as a circuit relay. It must not be behind a firewall.
#export ENABLE_CIRCUIT_RELAY=true
# Debug level. 0 = minimal info. 2 = max info.
export DEBUG_LEVEL=1
# END: Optional configuration settings
# Production database connection string.
export DBURL=mongodb://172.17.0.1:5555/ipfs-service-prod
# Customize these environment variables for your own installation. # Customize these environment variables for your own installation.
export AUTHSERVER=https://auth.fullstack.cash export AUTHSERVER=https://auth.fullstack.cash
export APISERVER=https://api.fullstack.cash/v5/ export APISERVER=https://api.fullstack.cash/v5/
@@ -11,10 +32,5 @@ export PORT=5001 # REST API
export IPFS_TCP_PORT=5668 # IPSF TCP Port export IPFS_TCP_PORT=5668 # IPSF TCP Port
export IPFS_WS_PORT=5669 # IPFS WS Port export IPFS_WS_PORT=5669 # IPFS WS Port
# Production database connection string.
export DBURL=mongodb://172.17.0.1:5555/ipfs-service-prod
#export ENABLE_CIRCUIT_RELAY=1
export SVC_ENV=production export SVC_ENV=production
npm start npm start
+2 -1
View File
@@ -54,7 +54,8 @@ class IpfsCoordAdapter {
isCircuitRelay: this.config.isCircuitRelay, isCircuitRelay: this.config.isCircuitRelay,
apiInfo: this.config.apiInfo, apiInfo: this.config.apiInfo,
announceJsonLd: this.config.announceJsonLd, announceJsonLd: this.config.announceJsonLd,
mnemonic: this.config.mnemonic mnemonic: this.config.mnemonic,
debugLevel: this.config.debugLevel
}) })
// Wait for the ipfs-coord library to signal that it is ready. // Wait for the ipfs-coord library to signal that it is ready.
+1 -1
View File
@@ -36,7 +36,7 @@ class Controllers {
await this.adapters.start() await this.adapters.start()
// Attach the REST controllers to the Koa app. // Attach the REST controllers to the Koa app.
this.attachRESTControllers(app) // this.attachRESTControllers(app)
this.attachRPCControllers() this.attachRPCControllers()
} }