1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

Merge branch 'feature/network_switcher' of github.com:oceanprotocol/commons into feature/network_switcher

This commit is contained in:
Max Berman 2020-01-16 13:53:02 +01:00
commit 279c413874
3 changed files with 18 additions and 7 deletions

View File

@ -30,7 +30,7 @@ If you're a developer and want to contribute to, or want to utilize this marketp
- [⛵️ Environment Variables](#-environment-variables)
- [Client](#client)
- [Server](#server)
- [Network & Endpoint Switches](#network-amp-endpoint-switches)
- [Network & Endpoint Switches](#network--endpoint-switches)
- [Feature Switches](#feature-switches)
- [More Settings](#more-settings)
- [👩‍🔬 Testing](#-testing)
@ -83,7 +83,12 @@ cd barge
./start_ocean.sh --no-commons
```
Then set [environment variables](#-environment-variables) to use those local connections.
Then set the [`REACT_APP_OCEAN_NETWORK` environment variable](#-environment-variables) to `spree` to use those local connections:
```bash
# in client/.env
REACT_APP_OCEAN_NETWORK=spree
```
Finally, you need to copy the generated contract artifacts out of the Docker container. To do this, execute this script in another terminal:
@ -116,13 +121,13 @@ The `./client/src/config.ts` file is setup to prioritize environment variables f
By setting environment variables, you can easily switch between Ocean networks the commons client connects to, without directly modifying `./client/src/config.ts`. This is helpful e.g. for local development so you don't accidentially commit changes to the config file.
For local development, you can use a `.env.local` file. There's an example file with the most common network configurations preconfigured:
For local development, you can use a `.env` file. There's an example file with the most common network configurations preconfigured:
```bash
cp client/.env.local.example client/.env.local
cp client/.env.example client/.env
# uncomment the config you need
vi client/.env.local
vi client/.env
```
#### Server
@ -153,6 +158,13 @@ For more control, you can overwrite individual endpoints in addition to the abov
- `REACT_APP_SECRET_STORE_URI`
- `REACT_APP_FAUCET_URI`
A common use case for that is to switch between different Aquarius instances to get a different asset catalogue. In that case, you would use `REACT_APP_OCEAN_NETWORK` to select the network, but then overwrite only `REACT_APP_AQUARIUS_URI`, e.g.:
```
REACT_APP_OCEAN_NETWORK=pacific
REACT_APP_AQUARIUS_URI=https://aquarius.test.oceanprotocol.com
```
#### Feature Switches
Beside configuring the network endpopints, the client allows to activate some features with environment variables in `client/.env.local`:

View File

@ -1,5 +1,4 @@
node_modules
.env.local
.env
build
coverage

View File

@ -6,7 +6,7 @@
#
# AUTO NETWORK CONNECTIONS
# ------------------------
# This env var is a shortcut for a set Ocean network component endpoints.
# This env var is a shortcut for a set of Ocean network component endpoints.
#
# Possible values: pacific, nile, duero, spree
REACT_APP_OCEAN_NETWORK=pacific