@open-xchange/fastify-sdk 0.2.4 → 0.2.5

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.
Files changed (3) hide show
  1. package/README.md +6 -6
  2. package/lib/app.js +4 -4
  3. package/package.json +6 -12
package/README.md CHANGED
@@ -64,7 +64,7 @@ Creates a configured Fastify instance with standard OX defaults.
64
64
  swagger: false | { enabled, openapi }, // Default: false
65
65
  static: false | true | { root, preCompressed, ... }, // Default: false
66
66
  },
67
- metricsServer: true, // Default: true (separate Fastify on port 9000)
67
+ metricsServer: true, // Default: true (separate Fastify on port 9090)
68
68
  database: { mariadb: true }, // Auto-manages pool readiness, health checks, shutdown
69
69
  config: { // YAML config file watching
70
70
  filename: 'config.yaml',
@@ -122,7 +122,7 @@ registerReadinessCheck(async () => { await mariadbHealthCheck(pool) })
122
122
  registerHealthCheck(async () => { await mariadbHealthCheck(pool) })
123
123
  ```
124
124
 
125
- Registered checks are run by the metrics server (`GET /ready` and `GET /live` on port 9000). See [Metrics server](#metrics-server-default-enabled) below.
125
+ Registered checks are run by the metrics server (`GET /ready` and `GET /live` on port 9090). See [Metrics server](#metrics-server-default-enabled) below.
126
126
 
127
127
  ### MariaDB
128
128
 
@@ -260,7 +260,7 @@ Standard security headers. `contentSecurityPolicy: false`, `crossOriginEmbedderP
260
260
 
261
261
  ### Metrics server (default: enabled)
262
262
 
263
- A separate Fastify instance on port 9000, serving health probes and Prometheus metrics.
263
+ A separate Fastify instance on port 9090, serving health probes and Prometheus metrics.
264
264
 
265
265
  | Endpoint | Purpose | Response |
266
266
  |---|---|---|
@@ -272,11 +272,11 @@ A separate Fastify instance on port 9000, serving health probes and Prometheus m
272
272
 
273
273
  The metrics server starts automatically in `createApp()`'s `onReady` hook and closes in `onClose`. Disable with `metricsServer: false` (used by `createTestApp()` to avoid port binding in tests).
274
274
 
275
- Port 9000 is hardcoded to match all existing K8s probe and Prometheus configs.
275
+ Port 9090 is hardcoded to match all existing K8s probe and Prometheus configs.
276
276
 
277
277
  ### Metrics plugin (default: enabled)
278
278
 
279
- Registers `fastify-metrics` collectors on the main app (request duration, etc.) but does **not** serve an endpoint — metrics are read from `prom-client`'s registry by the metrics server on port 9000.
279
+ Registers `fastify-metrics` collectors on the main app (request duration, etc.) but does **not** serve an endpoint — metrics are read from `prom-client`'s registry by the metrics server on port 9090.
280
280
 
281
281
  ### Sensible (always enabled)
282
282
 
@@ -372,7 +372,7 @@ try {
372
372
 
373
373
  This starts:
374
374
  - **Port 8080** (app) — your routes (auto-loaded from `routes/`), with CORS, Helmet, logging, JWT
375
- - **Port 9000** (metrics server) — `GET /live`, `GET /ready`, `GET /metrics`
375
+ - **Port 9090** (metrics server) — `GET /live`, `GET /ready`, `GET /metrics`
376
376
 
377
377
  ## Development
378
378
 
package/lib/app.js CHANGED
@@ -68,7 +68,7 @@ import metricsPlugin from './plugins/metrics.js'
68
68
  * @property {boolean} [routes.routeParams] Enable route parameters from directory names.
69
69
  * @property {FastifyServerOptions} [fastify] Options passed directly to the Fastify constructor.
70
70
  * @property {PluginsConfig} [plugins] Plugin configuration.
71
- * @property {boolean} [metricsServer=true] Start a metrics/health server on port 9000 (`/live`, `/ready`, `/metrics`).
71
+ * @property {boolean} [metricsServer=true] Start a metrics/health server on port 9090 (`/live`, `/ready`, `/metrics`).
72
72
  * @property {{ mariadb?: true | Record<string, import('mariadb').Pool> }} [database] Database pools to manage. Pass `{ mariadb: true }` to create pools from the `DATABASES` env var, or pass pre-created pools. Foundation waits for readiness, registers health checks, and closes pools on shutdown.
73
73
  * @property {ConfigFileRegistration | ConfigFileRegistration[]} [config] YAML configuration files to watch. Foundation creates the config registry, registers files on ready, and closes the watcher on shutdown.
74
74
  * @property {() => void | Promise<void>} [onReady] Hook called when the Fastify instance is ready.
@@ -82,7 +82,7 @@ import metricsPlugin from './plugins/metrics.js'
82
82
  /**
83
83
  * Creates a pre-configured Fastify application with standard OX infrastructure:
84
84
  * env loading, logging, CORS, helmet, metrics, Swagger, static files, auto-loaded
85
- * plugins/routes, a metrics server on port 9000, and graceful shutdown handlers.
85
+ * plugins/routes, a metrics server on port 9090, and graceful shutdown handlers.
86
86
  *
87
87
  * @param {CreateAppOptions} options
88
88
  * @returns {Promise<FoundationApp>} A Fastify instance with an added `start()` method.
@@ -244,8 +244,8 @@ export async function createApp (options = {}) {
244
244
  if (metricsServer !== false) {
245
245
  const { createMetricsServer } = await import('./metrics-server.js')
246
246
  const server = createMetricsServer()
247
- await server.listen({ port: 9000, host: process.env.BIND_ADDR })
248
- app.log.info('Metrics server listening on port 9000')
247
+ await server.listen({ port: 9090, host: process.env.BIND_ADDR })
248
+ app.log.info('Metrics server listening on port 9090')
249
249
 
250
250
  app.addHook('onClose', async () => {
251
251
  await server.close()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/fastify-sdk",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Shared foundation package for OX App Suite Node.js services",
5
5
  "private": false,
6
6
  "type": "module",
@@ -13,11 +13,6 @@
13
13
  "./redis": "./lib/redis/index.js",
14
14
  "./testing": "./lib/testing/index.js"
15
15
  },
16
- "scripts": {
17
- "lint": "eslint . --cache --fix",
18
- "test": "vitest run",
19
- "test:coverage": "vitest run --coverage"
20
- },
21
16
  "author": "Open-Xchange",
22
17
  "license": "AGPL-3.0-or-later",
23
18
  "dependencies": {
@@ -75,10 +70,9 @@
75
70
  "engines": {
76
71
  "node": ">=20"
77
72
  },
78
- "packageManager": "pnpm@10.27.0",
79
- "pnpm": {
80
- "onlyBuiltDependencies": [
81
- "unrs-resolver"
82
- ]
73
+ "scripts": {
74
+ "lint": "eslint . --cache --fix",
75
+ "test": "vitest run",
76
+ "test:coverage": "vitest run --coverage"
83
77
  }
84
- }
78
+ }