@protobase/cli 0.96.9 → 0.96.10
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/dist/cli/package.js
CHANGED
package/dist/serve/env.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readTrustedProxies } from "./client-address.js";
|
|
2
2
|
import { readDbConnections } from "@protobase/server";
|
|
3
|
+
import { isIP } from "node:net";
|
|
3
4
|
import { readSigningKey } from "@protobase/server/mobile-release";
|
|
4
5
|
//#region src/serve/env.ts
|
|
5
6
|
const defaultPort = 8787;
|
|
@@ -12,12 +13,15 @@ const readBoolean = (env, name, fallback) => {
|
|
|
12
13
|
const readServeEnv = (env) => {
|
|
13
14
|
const port = env.PORT ? Number(env.PORT) : defaultPort;
|
|
14
15
|
if (!Number.isInteger(port) || port < 0 || port > 65535) throw new Error(`PORT must be a port number, not "${env.PORT}"`);
|
|
16
|
+
const host = env.PROTOBASE_HOST || void 0;
|
|
17
|
+
if (host && isIP(host) === 0) throw new Error(`PROTOBASE_HOST must be an IP address, such as 127.0.0.1, not "${host}"`);
|
|
15
18
|
const minutes = env.PROTOBASE_FILES_CLEANUP_MINUTES ? Number(env.PROTOBASE_FILES_CLEANUP_MINUTES) : 60;
|
|
16
19
|
if (!Number.isInteger(minutes) || minutes < 0) throw new Error(`PROTOBASE_FILES_CLEANUP_MINUTES must be a whole number of minutes, not "${env.PROTOBASE_FILES_CLEANUP_MINUTES}"`);
|
|
17
20
|
const mobileSigningKey = readSigningKey(env);
|
|
18
21
|
const connections = env.PROTOBASE_DB_CONNECTIONS ? readDbConnections(env) : void 0;
|
|
19
22
|
return {
|
|
20
23
|
port,
|
|
24
|
+
...host && { host },
|
|
21
25
|
databaseUrl: env.DATABASE_URL || void 0,
|
|
22
26
|
...connections && { dbConnections: connections },
|
|
23
27
|
requestLog: readBoolean(env, "REQUEST_LOG", false),
|
package/dist/serve/lifecycle.js
CHANGED
|
@@ -12,9 +12,9 @@ import pg from "pg";
|
|
|
12
12
|
import { assistantSettings, authStoreTables, backgroundSettled, checkAi, checkAuthSchema, checkCalls, checkChanges, checkChannelSends, checkComments, checkComputed, checkDerived, checkJobsSchema, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkResourcesOutsideAuthStore, checkStatusSchema, checkUserTablesSchema, checkWebhooksSchema, checkWorkflowsSchema, configExports, createFileCleanup, relayed, sqlSends, startJobs } from "@protobase/server";
|
|
13
13
|
import { createAdaptorServer, upgradeWebSocket } from "@hono/node-server";
|
|
14
14
|
//#region src/serve/lifecycle.ts
|
|
15
|
-
const listen = (server, port) => new Promise((resolve, reject) => {
|
|
15
|
+
const listen = (server, port, host) => new Promise((resolve, reject) => {
|
|
16
16
|
server.once("error", reject);
|
|
17
|
-
server.listen(port, () => {
|
|
17
|
+
server.listen(port, host, () => {
|
|
18
18
|
server.off("error", reject);
|
|
19
19
|
resolve();
|
|
20
20
|
});
|
|
@@ -87,7 +87,7 @@ const startServe = async ({ config, env, openDb = (url) => openAppDatabase(pg, u
|
|
|
87
87
|
overrideGlobalObjects: false,
|
|
88
88
|
websocket: { server: sockets }
|
|
89
89
|
});
|
|
90
|
-
await listen(server, env.port).catch(async (error) => {
|
|
90
|
+
await listen(server, env.port, env.host).catch(async (error) => {
|
|
91
91
|
await jobs?.stop();
|
|
92
92
|
throw error;
|
|
93
93
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.96.
|
|
3
|
+
"version": "0.96.10",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.96.
|
|
47
|
-
"@protobase/layout": "0.96.
|
|
48
|
-
"@protobase/query": "0.96.
|
|
49
|
-
"@protobase/schema": "0.96.
|
|
50
|
-
"@protobase/server": "0.96.
|
|
51
|
-
"@protobase/ui": "0.96.
|
|
52
|
-
"@protobase/workflows": "0.96.
|
|
46
|
+
"@protobase/config": "0.96.10",
|
|
47
|
+
"@protobase/layout": "0.96.10",
|
|
48
|
+
"@protobase/query": "0.96.10",
|
|
49
|
+
"@protobase/schema": "0.96.10",
|
|
50
|
+
"@protobase/server": "0.96.10",
|
|
51
|
+
"@protobase/ui": "0.96.10",
|
|
52
|
+
"@protobase/workflows": "0.96.10",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -18,7 +18,7 @@ Develop, build and run an app, on servers, in containers and on phones.
|
|
|
18
18
|
- [Source maps](../reference/cli.md#source-maps): The bundle and plugins can carry source maps with debug ids, for an error tracker to read browser stack frames.
|
|
19
19
|
- [Extensions](../reference/cli.md#extensions): A host adds its own widgets, dock assistant tools (`assistant/tools.ts`) and MCP tools (`mcp/tools.ts`) to every app it builds.
|
|
20
20
|
- [Native packages](../reference/cli.md#native-packages): npm packages with native add-ons are bundled for Linux.
|
|
21
|
-
- [Serve runtime](../reference/cli.md#serve): Runs a bundle, set by environment variables, with a health check, startup checks, jobs and a clean shutdown.
|
|
21
|
+
- [Serve runtime](../reference/cli.md#serve): Runs a bundle, set by environment variables, with a health check, startup checks, jobs and a clean shutdown. `PROTOBASE_HOST=127.0.0.1` keeps it to this computer.
|
|
22
22
|
- [Host module list](../reference/cli.md#the-config-module): Each release of `@protobase/cli` carries the modules its runtime supplies to a bundle as `@protobase/cli/host-modules.json`, for a host to check a bundle's imports against the version that serves it.
|
|
23
23
|
- [Migrations at update time](../guides/deploy.md#migrations): The bundle carries the project's migrations, and the runtime applies them in one transaction before the new version serves.
|
|
24
24
|
- [Single-file runtime](../reference/cli.md#build-serve): The runtime as one file, so a host needs only Bun and that file.
|
|
@@ -426,6 +426,7 @@ Serves the API of a bundle from `protobase build` and owns the process around it
|
|
|
426
426
|
| `DATABASE_URL` | the API's pool (Kysely over `pg`, 10 connections) |
|
|
427
427
|
| `PROTOBASE_DB_CONNECTIONS` | the connections that pool opens, such as the database's limit for the app; default 10. Sign-in's store shares them. [API functions](../guides/api-functions.md) and [jobs](jobs.md) hold at most one less, so a long import leaves a connection to page and API requests; those with [`longQueries`](../guides/api-functions.md#long-queries) take theirs from one more connection, kept for them. A query waits at most 2 seconds for a free connection, then fails with `503 connections-busy` ([Safety](api.md#safety)); a new connection may take up to 30 seconds to open, such as while a database that scaled to zero wakes |
|
|
428
428
|
| `PORT` | default 8787 |
|
|
429
|
+
| `PROTOBASE_HOST` | the IP address the server listens on, such as `127.0.0.1` so only this computer reaches it; default every interface |
|
|
429
430
|
| `REQUEST_LOG` | `true` logs every request; default `false` |
|
|
430
431
|
| `PROTOBASE_SMTP_URL` | the SMTP server for password-reset mail, emailed sign-in and two-factor codes and the app's own [email](email.md), credential included: `smtp://user:password@host:587` (STARTTLS required, `?requireTLS=false` sends in plaintext, see [Email](email.md#configuration)) or `smtps://...:465`; without it they are off ([Password reset](auth.md#password-reset), [Emailed sign-in codes](auth.md#emailed-sign-in-codes)) |
|
|
431
432
|
| `PROTOBASE_MAIL_FROM` | the sender of that mail, a plain address such as `noreply@admin.example.com`; set with `PROTOBASE_SMTP_URL` or not at all |
|