mirror of https://github.com/status-im/js-waku.git
Connect to prod fleet by default, test fleet for local development
This commit is contained in:
parent
2cd87b561d
commit
a69c483c46
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Testing: Upgrade nim-waku node to v0.3.
|
- Testing: Upgrade nim-waku node to v0.3.
|
||||||
- **Breaking**: Modify `WakuStore.queryHistory()` to accept one `Object` instead of multiple individual arguments.
|
- **Breaking**: Modify `WakuStore.queryHistory()` to accept one `Object` instead of multiple individual arguments.
|
||||||
- `getStatusFleetNodes` return prod nodes by default, instead of test nodes.
|
- `getStatusFleetNodes` return prod nodes by default, instead of test nodes.
|
||||||
|
- Examples (web chat): Connect to prod fleet by default, test fleet for local development.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Expose `Enviroment` and `Protocol` enums to pass to `getStatusFleetNodes`.
|
- Expose `Enviroment` and `Protocol` enums to pass to `getStatusFleetNodes`.
|
||||||
|
|
|
@ -3,10 +3,11 @@ import { useEffect, useState } from 'react';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import {
|
import {
|
||||||
ChatMessage,
|
ChatMessage,
|
||||||
WakuMessage,
|
getStatusFleetNodes,
|
||||||
|
Environment,
|
||||||
StoreCodec,
|
StoreCodec,
|
||||||
Waku,
|
Waku,
|
||||||
getStatusFleetNodes,
|
WakuMessage,
|
||||||
} from 'js-waku';
|
} from 'js-waku';
|
||||||
import handleCommand from './command';
|
import handleCommand from './command';
|
||||||
import Room from './Room';
|
import Room from './Room';
|
||||||
|
@ -171,7 +172,7 @@ async function initWaku(setter: (waku: Waku) => void) {
|
||||||
|
|
||||||
setter(waku);
|
setter(waku);
|
||||||
|
|
||||||
const nodes = await getStatusFleetNodes();
|
const nodes = await getNodes();
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
nodes.map((addr) => {
|
nodes.map((addr) => {
|
||||||
return waku.dial(addr);
|
return waku.dial(addr);
|
||||||
|
@ -181,3 +182,12 @@ async function initWaku(setter: (waku: Waku) => void) {
|
||||||
console.log('Issue starting waku ', e);
|
console.log('Issue starting waku ', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getNodes() {
|
||||||
|
// Works with react-scripts
|
||||||
|
if (process?.env?.NODE_ENV === 'development') {
|
||||||
|
return getStatusFleetNodes(Environment.Test);
|
||||||
|
} else {
|
||||||
|
return getStatusFleetNodes(Environment.Prod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue