diff --git a/packages/concordia-app/src/constants/configuration/defaults.js b/packages/concordia-app/src/constants/configuration/defaults.js index 1e72777..c288c9c 100644 --- a/packages/concordia-app/src/constants/configuration/defaults.js +++ b/packages/concordia-app/src/constants/configuration/defaults.js @@ -3,6 +3,9 @@ export const WEB3_PORT_DEFAULT = '8545'; 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'; diff --git a/packages/concordia-app/src/utils/drizzleUtils.js b/packages/concordia-app/src/utils/drizzleUtils.js index 0f4291f..5496d85 100755 --- a/packages/concordia-app/src/utils/drizzleUtils.js +++ b/packages/concordia-app/src/utils/drizzleUtils.js @@ -1,6 +1,9 @@ import { + REACT_APP_CONCORDIA_HOST_DEFAULT, + REACT_APP_CONCORDIA_PORT_DEFAULT, REACT_APP_CONTRACTS_SUPPLIER_HOST_DEFAULT, - REACT_APP_CONTRACTS_SUPPLIER_PORT_DEFAULT, REACT_APP_CONTRACTS_VERSION_HASH_DEFAULT, + REACT_APP_CONTRACTS_SUPPLIER_PORT_DEFAULT, + REACT_APP_CONTRACTS_VERSION_HASH_DEFAULT, } from '../constants/configuration/defaults'; import CONTRACTS from '../constants/contracts/ContractNames'; @@ -11,13 +14,15 @@ function getContractsDownloadRequest() { || REACT_APP_CONTRACTS_SUPPLIER_PORT_DEFAULT; const CONTRACTS_VERSION_HASH = process.env.REACT_APP_CONTRACTS_VERSION_HASH || REACT_APP_CONTRACTS_VERSION_HASH_DEFAULT; + const HOST = process.env.REACT_APP_CONCORDIA_HOST || REACT_APP_CONCORDIA_HOST_DEFAULT; + const PORT = process.env.REACT_APP_CONCORDIA_PORT || REACT_APP_CONCORDIA_PORT_DEFAULT; const xhrRequest = new XMLHttpRequest(); xhrRequest.open('GET', `http://${CONTRACTS_SUPPLIER_HOST}:${CONTRACTS_SUPPLIER_PORT}/contracts/${CONTRACTS_VERSION_HASH}`, false); - xhrRequest.setRequestHeader('Access-Control-Allow-Origin', 'http://localhost:7000'); + xhrRequest.setRequestHeader('Access-Control-Allow-Origin', `${HOST}:${PORT}`); xhrRequest.setRequestHeader('Access-Control-Allow-Credentials', 'true'); return xhrRequest; @@ -31,7 +36,7 @@ function validateRemoteContracts(remoteContracts) { const contractsPresentStatus = CONTRACTS.map((contract) => ({ contract, - present: remoteContracts.contains((remoteContract) => remoteContract.contractName === contract), + present: remoteContracts.includes((remoteContract) => remoteContract.contractName === contract), })); if (contractsPresentStatus.reduce((accumulator, contract) => accumulator && contract.present, true)) { diff --git a/packages/concordia-contracts-provider/src/constants.js b/packages/concordia-contracts-provider/src/constants.js index 8a17128..fbe54de 100755 --- a/packages/concordia-contracts-provider/src/constants.js +++ b/packages/concordia-contracts-provider/src/constants.js @@ -2,7 +2,7 @@ import path from 'path'; const PROVIDER_PORT = '8400'; const UPLOAD_CONTRACTS_DIRECTORY = path.join(__dirname, '..', 'contracts-uploads'); -const CORS_ALLOWED_ORIGINS = ['localhost:7000', '127.0.0.1:7000']; +const CORS_ALLOWED_ORIGINS = ['http://127.0.0.1:7000', 'http://localhost:7000']; export default { port: PROVIDER_PORT,