@bakery-framework/cli 2.3.0 → 2.4.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/package.json +3 -3
- package/src/worker.ts +11 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakery-framework/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Bakery entry point and process supervision: mode dispatch, dev watcher, cluster.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bakery",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"bun": ">=1.4.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@bakery-framework/core": "^2.
|
|
42
|
+
"@bakery-framework/core": "^2.4.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@bakery-framework/orm": "^2.
|
|
45
|
+
"@bakery-framework/orm": "^2.4.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"@bakery-framework/orm": {
|
package/src/worker.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
hostStore,
|
|
5
5
|
} from '@bakery-framework/core/core/bakery'
|
|
6
6
|
import {
|
|
7
|
+
checkHostMounts,
|
|
7
8
|
initConfig,
|
|
8
9
|
resolveHostConfig,
|
|
9
10
|
} from '@bakery-framework/core/core/config'
|
|
@@ -15,6 +16,7 @@ import {
|
|
|
15
16
|
handleRequest,
|
|
16
17
|
handleRequestError,
|
|
17
18
|
processResponse,
|
|
19
|
+
routeOf,
|
|
18
20
|
serveWebSocket,
|
|
19
21
|
} from '@bakery-framework/core/router'
|
|
20
22
|
import { Session } from '@bakery-framework/core/session'
|
|
@@ -247,8 +249,10 @@ function settleRequest(
|
|
|
247
249
|
try {
|
|
248
250
|
// Before anything binds: a rate limit that cannot mean anything (a refill
|
|
249
251
|
// of 0, a prefix without its slash) stops the boot here, naming the field,
|
|
250
|
-
// in the catch below.
|
|
252
|
+
// in the catch below. So does a host mount (a path without its slash, a
|
|
253
|
+
// pattern with '*' inside a label).
|
|
251
254
|
checkRateLimits(Bakery.config)
|
|
255
|
+
checkHostMounts(Bakery.config)
|
|
252
256
|
|
|
253
257
|
Bakery.server = Bun.serve({
|
|
254
258
|
port: PORT,
|
|
@@ -266,6 +270,9 @@ try {
|
|
|
266
270
|
const hostConfig = resolveHostConfig(hostname)
|
|
267
271
|
|
|
268
272
|
return hostStore.run({ config: hostConfig, hostname, req }, async () => {
|
|
273
|
+
// The limiter keys on the path as sent. An error page is looked up
|
|
274
|
+
// from `routeOf(req).path` instead, the path routing resolved, so a
|
|
275
|
+
// page request on a mounted host finds the subtree's error page.
|
|
269
276
|
const path = url.pathname
|
|
270
277
|
req.startNs = Bun.nanoseconds()
|
|
271
278
|
req.__hostname = hostname
|
|
@@ -281,7 +288,7 @@ try {
|
|
|
281
288
|
Bakery.sharedPool.incrementCounter(COUNTER_SLOTS.TOTAL_ERRORS, 1)
|
|
282
289
|
serveLog.SESSION_LOAD_ERR({ error: errorMsg(loadError) })
|
|
283
290
|
return await processResponse(
|
|
284
|
-
await handleRequestError(path, req, loadError),
|
|
291
|
+
await handleRequestError(routeOf(req).path, req, loadError),
|
|
285
292
|
req,
|
|
286
293
|
)
|
|
287
294
|
}
|
|
@@ -303,7 +310,7 @@ try {
|
|
|
303
310
|
|
|
304
311
|
if (isErrorResult(res)) {
|
|
305
312
|
Bakery.sharedPool.incrementCounter(COUNTER_SLOTS.TOTAL_ERRORS, 1)
|
|
306
|
-
return await handleRequestError(path, req, res)
|
|
313
|
+
return await handleRequestError(routeOf(req).path, req, res)
|
|
307
314
|
}
|
|
308
315
|
// The app's own error page (see `hasOwnDocument`): sent as written,
|
|
309
316
|
// and still an error answer for the counter.
|
|
@@ -316,7 +323,7 @@ try {
|
|
|
316
323
|
async function errorHandler(error) {
|
|
317
324
|
Bakery.sharedPool.incrementCounter(COUNTER_SLOTS.TOTAL_ERRORS, 1)
|
|
318
325
|
serveLog.UNHANDLED_ERR({ error: errorMsg(error) })
|
|
319
|
-
return await handleRequestError(path, req, error)
|
|
326
|
+
return await handleRequestError(routeOf(req).path, req, error)
|
|
320
327
|
},
|
|
321
328
|
)
|
|
322
329
|
|