mirror of https://gitlab.com/ecentrics/concordia
Apostolos Fanakis
4 years ago
65 changed files with 496 additions and 243 deletions
@ -1,14 +1,2 @@ |
|||||
export const WEB3_HOST_DEFAULT = '127.0.0.1'; |
export const CONCORDIA_HOST_DEFAULT = '127.0.0.1'; |
||||
export const WEB3_PORT_DEFAULT = '8545'; |
export const CONCORDIA_PORT_DEFAULT = '7000'; |
||||
export const WEB3_PORT_SOCKET_TIMEOUT_DEFAULT = 30000; |
|
||||
export const WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT = 3; |
|
||||
|
|
||||
export const REACT_APP_CONCORDIA_HOST_DEFAULT = '127.0.0.1'; |
|
||||
export const REACT_APP_CONCORDIA_PORT_DEFAULT = '7000'; |
|
||||
|
|
||||
export const REACT_APP_RENDEZVOUS_HOST_DEFAULT = '127.0.0.1'; |
|
||||
export const REACT_APP_RENDEZVOUS_PORT_DEFAULT = '9090'; |
|
||||
|
|
||||
export const REACT_APP_CONTRACTS_SUPPLIER_HOST_DEFAULT = '127.0.0.1'; |
|
||||
export const REACT_APP_CONTRACTS_SUPPLIER_PORT_DEFAULT = '8400'; |
|
||||
export const REACT_APP_CONTRACTS_VERSION_HASH_DEFAULT = 'latest'; |
|
||||
|
@ -1,11 +0,0 @@ |
|||||
export const FORUM_CONTRACT = 'Forum'; |
|
||||
export const POST_VOTING_CONTRACT = 'PostVoting'; |
|
||||
export const VOTING_CONTRACT = 'Voting'; |
|
||||
|
|
||||
const CONTRACTS = [ |
|
||||
FORUM_CONTRACT, |
|
||||
POST_VOTING_CONTRACT, |
|
||||
VOTING_CONTRACT, |
|
||||
]; |
|
||||
|
|
||||
export default CONTRACTS; |
|
@ -1,13 +0,0 @@ |
|||||
export const USER_SIGNED_UP_EVENT = 'UserSignedUp'; |
|
||||
export const USERNAME_UPDATED_EVENT = 'UsernameUpdated'; |
|
||||
export const TOPIC_CREATED_EVENT = 'TopicCreated'; |
|
||||
export const POST_CREATED_EVENT = 'PostCreated'; |
|
||||
|
|
||||
const forumContractEvents = [ |
|
||||
USER_SIGNED_UP_EVENT, |
|
||||
USERNAME_UPDATED_EVENT, |
|
||||
TOPIC_CREATED_EVENT, |
|
||||
POST_CREATED_EVENT, |
|
||||
]; |
|
||||
|
|
||||
export default forumContractEvents; |
|
@ -1,8 +0,0 @@ |
|||||
import { FORUM_CONTRACT } from '../ContractNames'; |
|
||||
import forumContractEvents from './ForumContractEvents'; |
|
||||
|
|
||||
const appEvents = { |
|
||||
[FORUM_CONTRACT]: forumContractEvents, |
|
||||
}; |
|
||||
|
|
||||
export default appEvents; |
|
@ -1,42 +0,0 @@ |
|||||
import { EthereumContractIdentityProvider } from '@ezerous/eth-identity-provider'; |
|
||||
import databases from '../constants/orbit/OrbitDatabases'; |
|
||||
import { |
|
||||
REACT_APP_RENDEZVOUS_HOST_DEFAULT, |
|
||||
REACT_APP_RENDEZVOUS_PORT_DEFAULT, |
|
||||
} from '../constants/configuration/defaults'; |
|
||||
|
|
||||
const REACT_APP_RENDEZVOUS_HOST = process.env.REACT_APP_RENDEZVOUS_HOST || REACT_APP_RENDEZVOUS_HOST_DEFAULT; |
|
||||
const REACT_APP_RENDEZVOUS_PORT = process.env.REACT_APP_RENDEZVOUS_PORT || REACT_APP_RENDEZVOUS_PORT_DEFAULT; |
|
||||
|
|
||||
export const RENDEZVOUS_URL = `http://${REACT_APP_RENDEZVOUS_HOST}:${REACT_APP_RENDEZVOUS_PORT}`; |
|
||||
|
|
||||
const breezeOptions = { |
|
||||
ipfs: { |
|
||||
repo: 'concordia', |
|
||||
config: { |
|
||||
Addresses: { |
|
||||
Swarm: [ |
|
||||
// Use local signaling server (see also rendezvous script in package.json)
|
|
||||
// For more information: https://github.com/libp2p/js-libp2p-webrtc-star
|
|
||||
`/ip4/${REACT_APP_RENDEZVOUS_HOST}/tcp/${REACT_APP_RENDEZVOUS_PORT}/wss/p2p-webrtc-star`, |
|
||||
|
|
||||
// Use the following public servers if needed
|
|
||||
// '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
|
|
||||
// '/dns4/ wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star'
|
|
||||
], |
|
||||
}, |
|
||||
}, |
|
||||
preload: { |
|
||||
enabled: false, |
|
||||
}, |
|
||||
init: { |
|
||||
emptyRepo: true, |
|
||||
}, |
|
||||
}, |
|
||||
orbit: { |
|
||||
identityProvider: EthereumContractIdentityProvider, |
|
||||
databases, |
|
||||
}, |
|
||||
}; |
|
||||
|
|
||||
export default breezeOptions; |
|
@ -1,29 +0,0 @@ |
|||||
import Web3 from 'web3'; |
|
||||
import { |
|
||||
WEB3_HOST_DEFAULT, |
|
||||
WEB3_PORT_DEFAULT, |
|
||||
WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT, |
|
||||
WEB3_PORT_SOCKET_TIMEOUT_DEFAULT, |
|
||||
} from '../constants/configuration/defaults'; |
|
||||
|
|
||||
const { WEB3_HOST, WEB3_PORT, WEBSOCKET_TIMEOUT } = process.env; |
|
||||
|
|
||||
const web3WebsocketOptions = { |
|
||||
keepAlive: true, |
|
||||
timeout: WEBSOCKET_TIMEOUT !== undefined ? WEBSOCKET_TIMEOUT : WEB3_PORT_SOCKET_TIMEOUT_DEFAULT, |
|
||||
reconnect: { |
|
||||
maxAttempts: WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT, |
|
||||
}, |
|
||||
}; |
|
||||
|
|
||||
const web3 = (WEB3_HOST !== undefined && WEB3_PORT !== undefined) |
|
||||
? new Web3(new Web3.providers.WebsocketProvider(`ws://${WEB3_HOST}:${WEB3_PORT}`)) |
|
||||
: new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider( |
|
||||
`ws://${WEB3_HOST_DEFAULT}:${WEB3_PORT_DEFAULT}`, web3WebsocketOptions, |
|
||||
)); |
|
||||
|
|
||||
const web3Options = { |
|
||||
customProvider: web3, |
|
||||
}; |
|
||||
|
|
||||
export default web3Options; |
|
@ -1,11 +1,9 @@ |
|||||
import path from 'path'; |
import path from 'path'; |
||||
|
|
||||
const PROVIDER_PORT = '8400'; |
|
||||
const UPLOAD_CONTRACTS_DIRECTORY = path.join(__dirname, '..', 'contracts-uploads'); |
const UPLOAD_CONTRACTS_DIRECTORY = path.join(__dirname, '..', 'contracts-uploads'); |
||||
const CORS_ALLOWED_ORIGINS = ['http://127.0.0.1:7000', 'http://localhost:7000']; |
const CORS_ALLOWED_ORIGINS = ['http://127.0.0.1:7000', 'http://localhost:7000']; |
||||
|
|
||||
export default { |
export default { |
||||
port: PROVIDER_PORT, |
|
||||
uploadsDirectory: UPLOAD_CONTRACTS_DIRECTORY, |
uploadsDirectory: UPLOAD_CONTRACTS_DIRECTORY, |
||||
corsAllowedOrigins: CORS_ALLOWED_ORIGINS, |
corsAllowedOrigins: CORS_ALLOWED_ORIGINS, |
||||
}; |
}; |
||||
|
@ -1,21 +0,0 @@ |
|||||
const DEVELOP_CHAIN_HOST_DEFAULT = '127.0.0.1'; |
|
||||
const DEVELOP_CHAIN_PORT_DEFAULT = '8545'; |
|
||||
|
|
||||
const TEST_CHAIN_HOST_DEFAULT = '127.0.0.1'; |
|
||||
const TEST_CHAIN_PORT_DEFAULT = '8546'; |
|
||||
|
|
||||
const CONTRACTS_PROVIDER_HOST_DEFAULT = '127.0.0.1'; |
|
||||
const CONTRACTS_PROVIDER_PORT_DEFAULT = '8400'; |
|
||||
|
|
||||
module.exports = { |
|
||||
develop: { |
|
||||
chainHost: DEVELOP_CHAIN_HOST_DEFAULT, |
|
||||
chainPort: DEVELOP_CHAIN_PORT_DEFAULT, |
|
||||
}, |
|
||||
test: { |
|
||||
chainHost: TEST_CHAIN_HOST_DEFAULT, |
|
||||
chainPort: TEST_CHAIN_PORT_DEFAULT, |
|
||||
}, |
|
||||
contractsProviderHost: CONTRACTS_PROVIDER_HOST_DEFAULT, |
|
||||
contractsProviderPort: CONTRACTS_PROVIDER_PORT_DEFAULT, |
|
||||
}; |
|
@ -0,0 +1,60 @@ |
|||||
|
module.exports = { |
||||
|
'env': { |
||||
|
'browser': true, |
||||
|
'es6': true, |
||||
|
'jest': true |
||||
|
}, |
||||
|
'extends': [ |
||||
|
'plugin:react/recommended', |
||||
|
'airbnb' |
||||
|
], |
||||
|
'globals': { |
||||
|
'Atomics': 'readonly', |
||||
|
'SharedArrayBuffer': 'readonly' |
||||
|
}, |
||||
|
parser: 'babel-eslint', |
||||
|
'parserOptions': { |
||||
|
'ecmaFeatures': { |
||||
|
'jsx': true |
||||
|
}, |
||||
|
'ecmaVersion': 2018, |
||||
|
'sourceType': 'module' |
||||
|
}, |
||||
|
'plugins': [ |
||||
|
'react', |
||||
|
'react-hooks', |
||||
|
], |
||||
|
'rules': { |
||||
|
'react/jsx-props-no-spreading': 'off', |
||||
|
'import/extensions': 'off', |
||||
|
"react/jsx-indent": [ |
||||
|
'error', |
||||
|
4, |
||||
|
{ |
||||
|
checkAttributes: true, |
||||
|
indentLogicalExpressions: true |
||||
|
} |
||||
|
], |
||||
|
'react/require-default-props': 'off', |
||||
|
'react/prop-types': 'off', |
||||
|
'react-hooks/rules-of-hooks': 'error', |
||||
|
'react-hooks/exhaustive-deps': 'error', |
||||
|
'max-len': ['warn', {'code': 120, 'tabWidth': 4}], |
||||
|
'no-unused-vars': 'warn', |
||||
|
'no-console': 'warn', |
||||
|
'no-shadow': 'warn', |
||||
|
"no-multi-str": "warn", |
||||
|
"jsx-a11y/label-has-associated-control": [ 2, { |
||||
|
"labelAttributes": ["label"], |
||||
|
"controlComponents": ["Input"], |
||||
|
"depth": 3, |
||||
|
}], |
||||
|
}, |
||||
|
'settings': { |
||||
|
'import/resolver': { |
||||
|
'node': { |
||||
|
'extensions': ['.js', '.jsx'] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
}; |
@ -0,0 +1,16 @@ |
|||||
|
{ |
||||
|
"name": "concordia-shared", |
||||
|
"version": "0.1.0", |
||||
|
"private": true, |
||||
|
"scripts": { |
||||
|
"lint": "eslint --ext js,jsx . --format table" |
||||
|
}, |
||||
|
"devDependencies": { |
||||
|
"eslint": "^6.8.0", |
||||
|
"eslint-config-airbnb": "^18.1.0", |
||||
|
"eslint-plugin-import": "^2.20.2", |
||||
|
"eslint-plugin-jsx-a11y": "^6.2.3", |
||||
|
"eslint-plugin-react": "^7.19.0", |
||||
|
"eslint-plugin-react-hooks": "^4.2.0" |
||||
|
} |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
const { databases } = require('../constants/orbit/OrbitDatabases'); |
||||
|
const { rendezvousHost, rendezvousPort } = require('../environment/interpolated/rendezvous'); |
||||
|
|
||||
|
const getBreezeConfiguration = (identityProvider) => ({ |
||||
|
ipfs: { |
||||
|
repo: 'concordia', |
||||
|
config: { |
||||
|
Addresses: { |
||||
|
Swarm: [ |
||||
|
// Use local signaling server (see also rendezvous script in package.json)
|
||||
|
// For more information: https://github.com/libp2p/js-libp2p-webrtc-star
|
||||
|
`/ip4/${rendezvousHost}/tcp/${rendezvousPort}/wss/p2p-webrtc-star`, |
||||
|
|
||||
|
// Use the following public servers if needed
|
||||
|
// '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
|
||||
|
// '/dns4/ wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star'
|
||||
|
], |
||||
|
}, |
||||
|
}, |
||||
|
preload: { |
||||
|
enabled: false, |
||||
|
}, |
||||
|
init: { |
||||
|
emptyRepo: true, |
||||
|
}, |
||||
|
}, |
||||
|
orbit: { |
||||
|
identityProvider, |
||||
|
databases, |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
module.exports = getBreezeConfiguration; |
@ -0,0 +1,25 @@ |
|||||
|
const getWeb3ProviderUrl = require('../utils/web3'); |
||||
|
const { web3PortSocketConnectMaxAttempts, web3PortSocketTimeout } = require('../environment/interpolated/web3'); |
||||
|
const { web3HostEnv, web3PortEnv } = require('../environment/web3Env'); |
||||
|
|
||||
|
const getWeb3Configuration = (Web3) => { |
||||
|
const web3WebsocketOptions = { |
||||
|
keepAlive: true, |
||||
|
timeout: web3PortSocketTimeout, |
||||
|
reconnect: { |
||||
|
maxAttempts: web3PortSocketConnectMaxAttempts, |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
const web3 = (web3HostEnv !== undefined && web3PortEnv !== undefined) |
||||
|
? new Web3(new Web3.providers.WebsocketProvider(getWeb3ProviderUrl())) |
||||
|
: new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider(getWeb3ProviderUrl(), web3WebsocketOptions)); |
||||
|
|
||||
|
return { |
||||
|
customProvider: web3, |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
module.exports = { |
||||
|
getWeb3Configuration, |
||||
|
}; |
@ -0,0 +1,46 @@ |
|||||
|
// Contracts provider
|
||||
|
const CONTRACTS_PROVIDER_HOST_DEFAULT = '127.0.0.1'; |
||||
|
const CONTRACTS_PROVIDER_PORT_DEFAULT = '8400'; |
||||
|
const CONTRACTS_VERSION_HASH_DEFAULT = 'latest'; |
||||
|
|
||||
|
// Pinner
|
||||
|
const PINNER_API_PORT_DEFAULT = 4444; |
||||
|
|
||||
|
// Rendezvous
|
||||
|
const RENDEZVOUS_HOST_DEFAULT = '127.0.0.1'; |
||||
|
const RENDEZVOUS_PORT_DEFAULT = '9090'; |
||||
|
|
||||
|
// Web3 (probably ganache)
|
||||
|
const WEB3_HOST_DEFAULT = '127.0.0.1'; |
||||
|
const WEB3_PORT_DEFAULT = '8545'; |
||||
|
const WEB3_HOST_TEST_DEFAULT = '127.0.0.1'; |
||||
|
const WEB3_PORT_TEST_DEFAULT = '8546'; |
||||
|
const WEB3_PORT_SOCKET_TIMEOUT_DEFAULT = 30000; |
||||
|
const WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT = 3; |
||||
|
|
||||
|
module.exports = Object.freeze({ |
||||
|
contractsProvider: { |
||||
|
host: CONTRACTS_PROVIDER_HOST_DEFAULT, |
||||
|
port: CONTRACTS_PROVIDER_PORT_DEFAULT, |
||||
|
hash: CONTRACTS_VERSION_HASH_DEFAULT, |
||||
|
}, |
||||
|
pinner: { |
||||
|
port: PINNER_API_PORT_DEFAULT, |
||||
|
}, |
||||
|
rendezvous: { |
||||
|
host: RENDEZVOUS_HOST_DEFAULT, |
||||
|
port: RENDEZVOUS_PORT_DEFAULT, |
||||
|
}, |
||||
|
web3: { |
||||
|
develop: { |
||||
|
chainHost: WEB3_HOST_DEFAULT, |
||||
|
chainPort: WEB3_PORT_DEFAULT, |
||||
|
}, |
||||
|
test: { |
||||
|
chainHost: WEB3_HOST_TEST_DEFAULT, |
||||
|
chainPort: WEB3_PORT_TEST_DEFAULT, |
||||
|
}, |
||||
|
socketTimeout: WEB3_PORT_SOCKET_TIMEOUT_DEFAULT, |
||||
|
socketConnectMaxAttempts: WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT, |
||||
|
}, |
||||
|
}); |
@ -0,0 +1,16 @@ |
|||||
|
const FORUM_CONTRACT = 'Forum'; |
||||
|
const POST_VOTING_CONTRACT = 'PostVoting'; |
||||
|
const VOTING_CONTRACT = 'Voting'; |
||||
|
|
||||
|
const CONTRACTS = [ |
||||
|
FORUM_CONTRACT, |
||||
|
POST_VOTING_CONTRACT, |
||||
|
VOTING_CONTRACT, |
||||
|
]; |
||||
|
|
||||
|
module.exports = Object.freeze({ |
||||
|
FORUM_CONTRACT, |
||||
|
POST_VOTING_CONTRACT, |
||||
|
VOTING_CONTRACT, |
||||
|
CONTRACTS, |
||||
|
}); |
@ -0,0 +1,19 @@ |
|||||
|
const USER_SIGNED_UP_EVENT = 'UserSignedUp'; |
||||
|
const USERNAME_UPDATED_EVENT = 'UsernameUpdated'; |
||||
|
const TOPIC_CREATED_EVENT = 'TopicCreated'; |
||||
|
const POST_CREATED_EVENT = 'PostCreated'; |
||||
|
|
||||
|
const forumContractEvents = Object.freeze([ |
||||
|
USER_SIGNED_UP_EVENT, |
||||
|
USERNAME_UPDATED_EVENT, |
||||
|
TOPIC_CREATED_EVENT, |
||||
|
POST_CREATED_EVENT, |
||||
|
]); |
||||
|
|
||||
|
module.exports = { |
||||
|
USER_SIGNED_UP_EVENT, |
||||
|
USERNAME_UPDATED_EVENT, |
||||
|
TOPIC_CREATED_EVENT, |
||||
|
POST_CREATED_EVENT, |
||||
|
forumContractEvents, |
||||
|
}; |
@ -0,0 +1,8 @@ |
|||||
|
const forumContractEvents = require('./ForumContractEvents'); |
||||
|
const { FORUM_CONTRACT } = require('../ContractNames'); |
||||
|
|
||||
|
const appEvents = Object.freeze({ |
||||
|
[FORUM_CONTRACT]: forumContractEvents, |
||||
|
}); |
||||
|
|
||||
|
module.exports = appEvents; |
@ -0,0 +1,14 @@ |
|||||
|
// Depending on the package user (app in contrast to any of the other packages) the env var names should either include
|
||||
|
// the REACT_APP_ prefix or not
|
||||
|
const contractsProviderHostEnv = process.env.REACT_APP_CONTRACTS_PROVIDER_HOST |
||||
|
|| process.env.CONTRACTS_PROVIDER_HOST; |
||||
|
const contractsProviderPortEnv = process.env.REACT_APP_CONTRACTS_PROVIDER_PORT |
||||
|
|| process.env.CONTRACTS_PROVIDER_PORT; |
||||
|
const contractsVersionHashEnv = process.env.REACT_APP_CONTRACTS_VERSION_HASH |
||||
|
|| process.env.CONTRACTS_VERSION_HASH; |
||||
|
|
||||
|
module.exports = { |
||||
|
contractsProviderHostEnv, |
||||
|
contractsProviderPortEnv, |
||||
|
contractsVersionHashEnv, |
||||
|
}; |
@ -0,0 +1,21 @@ |
|||||
|
const { |
||||
|
contractsProviderHostEnv, contractsProviderPortEnv, contractsVersionHashEnv, |
||||
|
} = require('../contractsProviderEnv'); |
||||
|
|
||||
|
const { |
||||
|
contractsProvider: { |
||||
|
host: CONTRACTS_PROVIDER_HOST_DEFAULT, |
||||
|
port: CONTRACTS_PROVIDER_PORT_DEFAULT, |
||||
|
hash: CONTRACTS_VERSION_HASH_DEFAULT, |
||||
|
}, |
||||
|
} = require('../../constants/configuration/defaults'); |
||||
|
|
||||
|
const contractsProviderHost = contractsProviderHostEnv || CONTRACTS_PROVIDER_HOST_DEFAULT; |
||||
|
const contractsProviderPort = contractsProviderPortEnv || CONTRACTS_PROVIDER_PORT_DEFAULT; |
||||
|
const contractsVersionHash = contractsVersionHashEnv || CONTRACTS_VERSION_HASH_DEFAULT; |
||||
|
|
||||
|
module.exports = { |
||||
|
contractsProviderHost, |
||||
|
contractsProviderPort, |
||||
|
contractsVersionHash, |
||||
|
}; |
@ -0,0 +1,12 @@ |
|||||
|
const { |
||||
|
pinner: { |
||||
|
port: PINNER_API_PORT_DEFAULT, |
||||
|
}, |
||||
|
} = require('../../constants/configuration/defaults'); |
||||
|
const { pinnerApiPortEnv } = require('../pinnerEnv'); |
||||
|
|
||||
|
const pinnerApiPort = pinnerApiPortEnv || PINNER_API_PORT_DEFAULT; |
||||
|
|
||||
|
module.exports = { |
||||
|
pinnerApiPort, |
||||
|
}; |
@ -0,0 +1,15 @@ |
|||||
|
const { rendezvousHostEnv, rendezvousPortEnv } = require('../rendezvousEnv'); |
||||
|
const { |
||||
|
rendezvous: { |
||||
|
host: RENDEZVOUS_HOST_DEFAULT, |
||||
|
port: RENDEZVOUS_PORT_DEFAULT, |
||||
|
}, |
||||
|
} = require('../../constants/configuration/defaults'); |
||||
|
|
||||
|
const rendezvousHost = rendezvousHostEnv || RENDEZVOUS_HOST_DEFAULT; |
||||
|
const rendezvousPort = rendezvousPortEnv || RENDEZVOUS_PORT_DEFAULT; |
||||
|
|
||||
|
module.exports = { |
||||
|
rendezvousHost, |
||||
|
rendezvousPort, |
||||
|
}; |
@ -0,0 +1,9 @@ |
|||||
|
const contractsProvider = require('./contractsProvider'); |
||||
|
const rendezvous = require('./rendezvous'); |
||||
|
const web3 = require('./web3'); |
||||
|
|
||||
|
module.exports = { |
||||
|
contractsProvider, |
||||
|
rendezvous, |
||||
|
web3, |
||||
|
}; |
@ -0,0 +1,37 @@ |
|||||
|
const { |
||||
|
web3: { |
||||
|
develop: { |
||||
|
chainHost: WEB3_HOST_DEFAULT, |
||||
|
chainPort: WEB3_PORT_DEFAULT, |
||||
|
}, |
||||
|
test: { |
||||
|
chainHost: WEB3_HOST_TEST_DEFAULT, |
||||
|
chainPort: WEB3_PORT_TEST_DEFAULT, |
||||
|
}, |
||||
|
socketConnectMaxAttempts: WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT, |
||||
|
socketTimeout: WEB3_PORT_SOCKET_TIMEOUT_DEFAULT, |
||||
|
}, |
||||
|
} = require('../../constants/configuration/defaults'); |
||||
|
const { |
||||
|
web3HostEnv, web3HostTestEnv, web3PortEnv, web3PortSocketConnectMaxAttemptsEnv, web3PortSocketTimeoutEnv, |
||||
|
web3PortTestEnv, |
||||
|
} = require('../web3Env'); |
||||
|
|
||||
|
const web3Host = web3HostEnv || WEB3_HOST_DEFAULT; |
||||
|
const web3Port = web3PortEnv || WEB3_PORT_DEFAULT; |
||||
|
|
||||
|
const web3HostTest = web3HostTestEnv || WEB3_HOST_TEST_DEFAULT; |
||||
|
const web3PortTest = web3PortTestEnv || WEB3_PORT_TEST_DEFAULT; |
||||
|
|
||||
|
const web3PortSocketTimeout = web3PortSocketTimeoutEnv || WEB3_PORT_SOCKET_TIMEOUT_DEFAULT; |
||||
|
const web3PortSocketConnectMaxAttempts = web3PortSocketConnectMaxAttemptsEnv |
||||
|
|| WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT; |
||||
|
|
||||
|
module.exports = { |
||||
|
web3Host, |
||||
|
web3Port, |
||||
|
web3HostTest, |
||||
|
web3PortTest, |
||||
|
web3PortSocketTimeout, |
||||
|
web3PortSocketConnectMaxAttempts, |
||||
|
}; |
@ -0,0 +1,7 @@ |
|||||
|
// Depending on the package user (app in contrast to any of the other packages) the env var names should either include
|
||||
|
// the REACT_APP_ prefix or not
|
||||
|
const pinnerApiPortEnv = process.env.REACT_APP_PINNER_API_PORT || process.env.PINNER_API_PORT; |
||||
|
|
||||
|
module.exports = { |
||||
|
pinnerApiPortEnv, |
||||
|
}; |
@ -0,0 +1,9 @@ |
|||||
|
// Depending on the package user (app in contrast to any of the other packages) the env var names should either include
|
||||
|
// the REACT_APP_ prefix or not
|
||||
|
const rendezvousHostEnv = process.env.REACT_APP_RENDEZVOUS_HOST || process.env.RENDEZVOUS_HOST; |
||||
|
const rendezvousPortEnv = process.env.REACT_APP_RENDEZVOUS_PORT || process.env.RENDEZVOUS_PORT; |
||||
|
|
||||
|
module.exports = { |
||||
|
rendezvousHostEnv, |
||||
|
rendezvousPortEnv, |
||||
|
}; |
@ -0,0 +1,9 @@ |
|||||
|
const contractsProvider = require('./contractsProviderEnv'); |
||||
|
const rendezvous = require('./rendezvousEnv'); |
||||
|
const web3 = require('./web3Env'); |
||||
|
|
||||
|
module.exports = { |
||||
|
contractsProvider, |
||||
|
rendezvous, |
||||
|
web3, |
||||
|
}; |
@ -0,0 +1,24 @@ |
|||||
|
// Depending on the package user (app in contrast to any of the other packages) the env var names should either include
|
||||
|
// the REACT_APP_ prefix or not
|
||||
|
const web3HostEnv = process.env.REACT_APP_WEB3_HOST |
||||
|
|| process.env.WEB3_HOST; |
||||
|
const web3PortEnv = process.env.REACT_APP_WEB3_PORT |
||||
|
|| process.env.WEB3_PORT; |
||||
|
|
||||
|
// Web3 test environment shouldn't be available to the react app
|
||||
|
const web3HostTestEnv = process.env.WEB3_HOST_TEST; |
||||
|
const web3PortTestEnv = process.env.WEB3_PORT_TEST; |
||||
|
|
||||
|
const web3PortSocketTimeoutEnv = process.env.REACT_APP_WEB3_PORT_SOCKET_TIMEOUT |
||||
|
|| process.env.WEB3_PORT_SOCKET_TIMEOUT; |
||||
|
const web3PortSocketConnectMaxAttemptsEnv = process.env.REACT_APP_WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS |
||||
|
|| process.env.WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS; |
||||
|
|
||||
|
module.exports = { |
||||
|
web3HostEnv, |
||||
|
web3PortEnv, |
||||
|
web3HostTestEnv, |
||||
|
web3PortTestEnv, |
||||
|
web3PortSocketTimeoutEnv, |
||||
|
web3PortSocketConnectMaxAttemptsEnv, |
||||
|
}; |
@ -0,0 +1,5 @@ |
|||||
|
const { rendezvousHost, rendezvousPort } = require('../environment/interpolated/rendezvous'); |
||||
|
|
||||
|
const getRendezvousUrl = () => `http://${rendezvousHost}:${rendezvousPort}`; |
||||
|
|
||||
|
module.exports = getRendezvousUrl; |
@ -0,0 +1,6 @@ |
|||||
|
const { web3Port } = require('../environment/interpolated/web3'); |
||||
|
const { web3Host } = require('../environment/interpolated/web3'); |
||||
|
|
||||
|
const getWeb3ProviderUrl = () => `ws://${web3Host}:${web3Port}`; |
||||
|
|
||||
|
module.exports = getWeb3ProviderUrl; |
Loading…
Reference in new issue