File tree Expand file tree Collapse file tree 5 files changed +30
-6
lines changed Expand file tree Collapse file tree 5 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515### Changed
1616- Testing: Upgrade nim-waku node to v0.3.
1717- ** Breaking** : Modify ` WakuStore.queryHistory() ` to accept one ` Object ` instead of multiple individual arguments.
18+ - ` getStatusFleetNodes ` return prod nodes by default, instead of test nodes.
19+ - Examples (web chat): Connect to prod fleet by default, test fleet for local development.
20+ - Examples (cli chat): Connect to test fleet by default, use ` --prod ` to connect to prod fleet.
21+
22+ ### Fixed
23+ - Expose ` Enviroment ` and ` Protocol ` enums to pass to ` getStatusFleetNodes ` .
1824
1925## [ 0.3.0] - 2021-05-15
2026
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import util from 'util';
33
44import {
55 ChatMessage ,
6+ Environment ,
67 getStatusFleetNodes ,
78 StoreCodec ,
89 Waku ,
@@ -105,6 +106,7 @@ interface Options {
105106 staticNodes : Multiaddr [ ] ;
106107 listenAddr : string ;
107108 autoDial : boolean ;
109+ prod : boolean ;
108110}
109111
110112function processArguments ( ) : Options {
@@ -114,6 +116,7 @@ function processArguments(): Options {
114116 listenAddr : '/ip4/0.0.0.0/tcp/0' ,
115117 staticNodes : [ ] ,
116118 autoDial : false ,
119+ prod : false ,
117120 } ;
118121
119122 while ( passedArgs . length ) {
@@ -128,6 +131,9 @@ function processArguments(): Options {
128131 case '--autoDial' :
129132 opts . autoDial = true ;
130133 break ;
134+ case '--prod' :
135+ opts . prod = true ;
136+ break ;
131137 default :
132138 console . log ( `Unsupported argument: ${ arg } ` ) ;
133139 process . exit ( 1 ) ;
@@ -149,7 +155,9 @@ export function formatMessage(chatMsg: ChatMessage): string {
149155}
150156
151157async function addFleetNodes ( opts : Options ) : Promise < Options > {
152- await getStatusFleetNodes ( ) . then ( ( nodes ) =>
158+ await getStatusFleetNodes (
159+ opts . prod ? Environment . Prod : Environment . Test
160+ ) . then ( ( nodes ) =>
153161 nodes . map ( ( addr ) => {
154162 opts . staticNodes . push ( multiaddr ( addr ) ) ;
155163 } )
Original file line number Diff line number Diff line change @@ -3,10 +3,11 @@ import { useEffect, useState } from 'react';
33import './App.css' ;
44import {
55 ChatMessage ,
6- WakuMessage ,
6+ getStatusFleetNodes ,
7+ Environment ,
78 StoreCodec ,
89 Waku ,
9- getStatusFleetNodes ,
10+ WakuMessage ,
1011} from 'js-waku' ;
1112import handleCommand from './command' ;
1213import Room from './Room' ;
@@ -171,7 +172,7 @@ async function initWaku(setter: (waku: Waku) => void) {
171172
172173 setter ( waku ) ;
173174
174- const nodes = await getStatusFleetNodes ( ) ;
175+ const nodes = await getNodes ( ) ;
175176 await Promise . all (
176177 nodes . map ( ( addr ) => {
177178 return waku . dial ( addr ) ;
@@ -181,3 +182,12 @@ async function initWaku(setter: (waku: Waku) => void) {
181182 console . log ( 'Issue starting waku ' , e ) ;
182183 }
183184}
185+
186+ function getNodes ( ) {
187+ // Works with react-scripts
188+ if ( process ?. env ?. NODE_ENV === 'development' ) {
189+ return getStatusFleetNodes ( Environment . Test ) ;
190+ } else {
191+ return getStatusFleetNodes ( Environment . Prod ) ;
192+ }
193+ }
Original file line number Diff line number Diff line change 1- export { getStatusFleetNodes } from './lib/discover' ;
1+ export { getStatusFleetNodes , Environment , Protocol } from './lib/discover' ;
22
33export { Waku } from './lib/waku' ;
44export { WakuMessage } from './lib/waku_message' ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export enum Environment {
1515}
1616
1717export async function getStatusFleetNodes (
18- env : Environment = Environment . Test ,
18+ env : Environment = Environment . Prod ,
1919 protocol : Protocol = Protocol . websocket
2020) : Promise < string [ ] > {
2121 const res = await axios . get ( 'https://fleets.status.im/' , {
You can’t perform that action at this time.
0 commit comments