mirror of https://github.com/waku-org/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.
|
||||
- **Breaking**: Modify `WakuStore.queryHistory()` to accept one `Object` instead of multiple individual arguments.
|
||||
- `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
|
||||
- Expose `Enviroment` and `Protocol` enums to pass to `getStatusFleetNodes`.
|
||||
|
|
|
@ -3,10 +3,11 @@ import { useEffect, useState } from 'react';
|
|||
import './App.css';
|
||||
import {
|
||||
ChatMessage,
|
||||
WakuMessage,
|
||||
getStatusFleetNodes,
|
||||
Environment,
|
||||
StoreCodec,
|
||||
Waku,
|
||||
getStatusFleetNodes,
|
||||
WakuMessage,
|
||||
} from 'js-waku';
|
||||
import handleCommand from './command';
|
||||
import Room from './Room';
|
||||
|
@ -171,7 +172,7 @@ async function initWaku(setter: (waku: Waku) => void) {
|
|||
|
||||
setter(waku);
|
||||
|
||||
const nodes = await getStatusFleetNodes();
|
||||
const nodes = await getNodes();
|
||||
await Promise.all(
|
||||
nodes.map((addr) => {
|
||||
return waku.dial(addr);
|
||||
|
@ -181,3 +182,12 @@ async function initWaku(setter: (waku: Waku) => void) {
|
|||
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