@evolu/relay 1.1.2-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +16 -0
- package/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +1172 -0
- package/Dockerfile +66 -0
- package/LICENSE +21 -0
- package/README.docker.md +154 -0
- package/README.md +91 -0
- package/data/.gitkeep +2 -0
- package/dist/package.json +41 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +42 -0
- package/dist/src/logger.d.ts +2 -0
- package/dist/src/logger.d.ts.map +1 -0
- package/dist/src/logger.js +4 -0
- package/dist/src/nodejs.d.ts +3 -0
- package/dist/src/nodejs.d.ts.map +1 -0
- package/dist/src/nodejs.js +24 -0
- package/dist/src/params.d.ts +7 -0
- package/dist/src/params.d.ts.map +1 -0
- package/dist/src/params.js +6 -0
- package/docker-compose.yml +56 -0
- package/package.json +41 -0
- package/src/cli.ts +59 -0
- package/src/logger.ts +5 -0
- package/src/nodejs.ts +30 -0
- package/src/params.ts +9 -0
- package/tsconfig.json +10 -0
package/src/nodejs.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createNodeJsRelay } from "@evolu/nodejs";
|
|
2
|
+
import { mkdirSync } from "fs";
|
|
3
|
+
import { once } from "node:events";
|
|
4
|
+
import { logger } from "./logger.js";
|
|
5
|
+
import { CliParams } from "./params.js";
|
|
6
|
+
|
|
7
|
+
export async function startNodeJsRelay(options: CliParams): Promise<void> {
|
|
8
|
+
// Ensure the database is created in a predictable location for Docker.
|
|
9
|
+
mkdirSync("data", { recursive: true });
|
|
10
|
+
process.chdir("data");
|
|
11
|
+
|
|
12
|
+
if (options.enableLogging) {
|
|
13
|
+
logger.enabled = true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const relay = await createNodeJsRelay({ console: logger })({
|
|
17
|
+
port: options.port,
|
|
18
|
+
enableLogging: options.enableLogging,
|
|
19
|
+
name: options.name,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
await Promise.race([
|
|
23
|
+
once(process, "SIGINT"), // Ctrl-C
|
|
24
|
+
once(process, "SIGTERM"), // OS/k8s/etc requested termination
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
logger.enabled = true;
|
|
28
|
+
logger.log("Shutting down relay server");
|
|
29
|
+
relay[Symbol.dispose]();
|
|
30
|
+
}
|
package/src/params.ts
ADDED