@gasket/plugin-fastify 7.0.1 → 7.0.4

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
@@ -31,6 +31,7 @@ All the configurations for the plugin are added under `fastify` in the config:
31
31
  - `compression`: true by default. Can be set to false if applying compression
32
32
  differently.
33
33
  - `trustProxy`: Enable trust proxy option, [see Fastify documentation for possible values](https://fastify.dev/docs/latest/Reference/Server/#trustproxy)
34
+ - `disableRequestLogging`: Turn off request logging, true by default
34
35
 
35
36
  #### Example configuration
36
37
 
@@ -48,6 +49,18 @@ export default makeGasket({
48
49
  });
49
50
  ```
50
51
 
52
+ ## Actions
53
+
54
+ ### getFastifyApp
55
+
56
+ Get the Fastify app instance.
57
+
58
+ ```js
59
+ const app = actions.gasket.getFastifyApp();
60
+ ```
61
+
62
+ Each Gasket creates a single shared Fastify instance, ensuring consistent access to the same app instance wherever it's needed.
63
+
51
64
  ## Lifecycles
52
65
 
53
66
  ### fastify
package/lib/index.d.ts CHANGED
@@ -29,6 +29,8 @@ declare module '@gasket/core' {
29
29
  excludedRoutesRegex?: RegExp;
30
30
  /** Trust proxy configuration */
31
31
  trustProxy?: FastifyServerOptions['trustProxy'];
32
+ /** Fastify request logging per route */
33
+ disableRequestLogging?: boolean;
32
34
  };
33
35
  /** Middleware configuration */
34
36
  middleware?: {
package/lib/index.js CHANGED
@@ -21,11 +21,11 @@ const plugin = {
21
21
  actions: {
22
22
  getFastifyApp(gasket) {
23
23
  const { fastify: fastifyConfig = {}, http2, https } = gasket.config;
24
- const { trustProxy = false } = fastifyConfig;
24
+ const { trustProxy = false, disableRequestLogging = true } = fastifyConfig;
25
25
  const fastifyLogger = alignLogger(gasket.logger);
26
26
 
27
27
  // @ts-ignore
28
- app ??= fastify({ logger: fastifyLogger, trustProxy, https, http2 });
28
+ app ??= fastify({ logger: fastifyLogger, trustProxy, https, http2, disableRequestLogging });
29
29
 
30
30
  return app;
31
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasket/plugin-fastify",
3
- "version": "7.0.1",
3
+ "version": "7.0.4",
4
4
  "description": "Adds fastify support to your application",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -72,5 +72,5 @@
72
72
  "jest": {
73
73
  "rootDir": "test"
74
74
  },
75
- "gitHead": "0426b7f57bc2618606955912c0f3cd55174f5367"
75
+ "gitHead": "af49c0e42e7947e000faa771777b815b90aaffa3"
76
76
  }