2025-01-02 21:21:16 -06:00
|
|
|
import {BasicCollection} from "../src/collection-basic";
|
2025-01-01 22:56:34 -06:00
|
|
|
import {RhizomeNode, RhizomeNodeConfig} from "../src/node";
|
2024-12-25 17:24:18 -06:00
|
|
|
|
|
|
|
const start = 5000;
|
|
|
|
const range = 5000;
|
|
|
|
const getRandomPort = () => Math.floor(start + range * Math.random());
|
|
|
|
|
|
|
|
export class App extends RhizomeNode {
|
|
|
|
apiUrl: string;
|
|
|
|
|
|
|
|
constructor(config?: Partial<RhizomeNodeConfig>) {
|
|
|
|
// Randomizing ports to try to avoid collisions between tests.
|
|
|
|
super({
|
|
|
|
publishBindPort: getRandomPort(),
|
|
|
|
requestBindPort: getRandomPort(),
|
|
|
|
httpPort: getRandomPort(),
|
|
|
|
...config,
|
|
|
|
});
|
|
|
|
|
2025-01-02 21:21:16 -06:00
|
|
|
const users = new BasicCollection("user");
|
2024-12-25 17:24:18 -06:00
|
|
|
users.rhizomeConnect(this);
|
|
|
|
|
2024-12-25 19:27:36 -06:00
|
|
|
const {httpAddr, httpPort} = this.config;
|
2024-12-27 13:43:43 -06:00
|
|
|
this.apiUrl = `http://${httpAddr}:${httpPort}/api`;
|
2024-12-25 17:24:18 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|