mirror of https://github.com/waku-org/js-waku.git
Connect cli chat to prod fleet upon passing `--prod`
This commit is contained in:
parent
a69c483c46
commit
c4c259f47a
|
@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- **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.
|
||||
- Examples (cli chat): Connect to test fleet by default, use `--prod` to connect to prod fleet.
|
||||
|
||||
### Fixed
|
||||
- Expose `Enviroment` and `Protocol` enums to pass to `getStatusFleetNodes`.
|
||||
|
|
|
@ -3,6 +3,7 @@ import util from 'util';
|
|||
|
||||
import {
|
||||
ChatMessage,
|
||||
Environment,
|
||||
getStatusFleetNodes,
|
||||
StoreCodec,
|
||||
Waku,
|
||||
|
@ -105,6 +106,7 @@ interface Options {
|
|||
staticNodes: Multiaddr[];
|
||||
listenAddr: string;
|
||||
autoDial: boolean;
|
||||
prod: boolean;
|
||||
}
|
||||
|
||||
function processArguments(): Options {
|
||||
|
@ -114,6 +116,7 @@ function processArguments(): Options {
|
|||
listenAddr: '/ip4/0.0.0.0/tcp/0',
|
||||
staticNodes: [],
|
||||
autoDial: false,
|
||||
prod: false,
|
||||
};
|
||||
|
||||
while (passedArgs.length) {
|
||||
|
@ -128,6 +131,9 @@ function processArguments(): Options {
|
|||
case '--autoDial':
|
||||
opts.autoDial = true;
|
||||
break;
|
||||
case '--prod':
|
||||
opts.prod = true;
|
||||
break;
|
||||
default:
|
||||
console.log(`Unsupported argument: ${arg}`);
|
||||
process.exit(1);
|
||||
|
@ -149,7 +155,9 @@ export function formatMessage(chatMsg: ChatMessage): string {
|
|||
}
|
||||
|
||||
async function addFleetNodes(opts: Options): Promise<Options> {
|
||||
await getStatusFleetNodes().then((nodes) =>
|
||||
await getStatusFleetNodes(
|
||||
opts.prod ? Environment.Prod : Environment.Test
|
||||
).then((nodes) =>
|
||||
nodes.map((addr) => {
|
||||
opts.staticNodes.push(multiaddr(addr));
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue