@evolu/relay 4.1.5 → 4.2.1

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/README.md CHANGED
@@ -40,10 +40,11 @@ package. Clients reconnect and sync what they missed.
40
40
 
41
41
  The relay reads `PORT` and Relay-specific `EVOLU_RELAY_*` environment variables:
42
42
 
43
- | Variable | Default | Description |
44
- | ----------------------------- | -------- | --------------------------------------------------------------- |
45
- | `PORT` | `4000` | The TCP port to listen on, also supplied by hosting platforms. |
46
- | `EVOLU_RELAY_MAX_OWNER_BYTES` | No limit | The storage quota per owner, as a size literal such as `10MiB`. |
43
+ | Variable | Default | Description |
44
+ | ----------------------------- | -------- | ---------------------------------------------------------------------------------------------------- |
45
+ | `PORT` | `4000` | The TCP port to listen on, also supplied by hosting platforms. |
46
+ | `EVOLU_RELAY_MAX_OWNER_BYTES` | No limit | The storage quota per owner, as a size literal such as `10MiB`. |
47
+ | `EVOLU_RELAY_LOG_LEVEL` | `log` | The console level, from `trace` to `silent`. `debug` also logs connections, `trace` every SQL query. |
47
48
 
48
49
  Quota values use `ByteSizeLiteral`, such as `0B`, `512KiB`, or `1.5GiB`.
49
50
  Bare byte counts such as `1048576` are not accepted; use `1MiB` instead.
@@ -59,8 +60,11 @@ never fall back to defaults. `EVOLU_RELAY_PORT` is not supported; use `PORT`.
59
60
  PORT=4001 EVOLU_RELAY_MAX_OWNER_BYTES=10MiB npx @evolu/relay
60
61
  ```
61
62
 
62
- The Docker health check follows `PORT`. Use a fixed, nonzero port in Docker;
63
- `PORT=0` selects an unpredictable port that the health check cannot discover.
63
+ For uptime monitors and load balancers, the relay answers `GET` and `HEAD`
64
+ requests for `/health` with status 200 while its database file can be read and
65
+ with status 503 otherwise. The Docker health check requests it on `PORT`. Use a
66
+ fixed, nonzero port in Docker; `PORT=0` selects an unpredictable port that the
67
+ health check cannot discover.
64
68
  The image exposes port 4000, so map a custom port explicitly:
65
69
 
66
70
  ```bash
package/dist/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { ByteSizeLiteral, byteSizeToByteLength, createConsole, createConsoleFormatter, env, optional, Port, PortFromString, withDefault, } from "@evolu/common";
2
+ import { ByteSizeLiteral, byteSizeToByteLength, createConsole, createConsoleFormatter, env, optional, Port, PortFromString, union, withDefault, } from "@evolu/common";
3
3
  import { installPolyfills } from "@evolu/common/polyfills";
4
4
  import { createRelay, createRelayDeps, runMain } from "@evolu/nodejs";
5
5
  import { mkdirSync } from "node:fs";
@@ -8,13 +8,13 @@ installPolyfills();
8
8
  const RelayEnv = env({
9
9
  port: withDefault(optional(PortFromString), Port.orThrow(4000)),
10
10
  EVOLU_RELAY: {
11
+ logLevel: optional(union("trace", "debug", "log", "info", "warn", "error", "silent")),
11
12
  maxOwnerBytes: optional(ByteSizeLiteral),
12
13
  },
13
14
  });
14
15
  const deps = {
15
16
  ...createRelayDeps(),
16
17
  console: createConsole({
17
- // level: "debug",
18
18
  formatter: createConsoleFormatter()({
19
19
  timestampFormat: "relative",
20
20
  }),
@@ -22,6 +22,8 @@ const deps = {
22
22
  };
23
23
  await runMain(deps)((run) => {
24
24
  const config = RelayEnv.orThrow(process.env, { errors: "all" });
25
+ if (config.logLevel !== undefined)
26
+ run.deps.console.setLevel(config.logLevel);
25
27
  const maxOwnerBytes = config.maxOwnerBytes === undefined
26
28
  ? undefined
27
29
  : byteSizeToByteLength(config.maxOwnerBytes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolu/relay",
3
- "version": "4.1.5",
3
+ "version": "4.2.1",
4
4
  "description": "Evolu Relay server",
5
5
  "keywords": [
6
6
  "evolu",
@@ -27,8 +27,8 @@
27
27
  "README.md"
28
28
  ],
29
29
  "dependencies": {
30
- "@evolu/common": "8.15.1",
31
- "@evolu/nodejs": "4.1.1"
30
+ "@evolu/common": "8.17.0",
31
+ "@evolu/nodejs": "4.2.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@evolu/typescript-config": "0.1.1",