@openapi-typescript-infra/service 4.6.0 → 4.6.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openapi-typescript-infra/service",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "description": "An opinionated framework for building configuration driven services - web, api, or ob. Uses OpenAPI, pino logging, express, confit, Typescript and vitest.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -6,7 +6,7 @@ export interface ConfigurationItemEnabled {
6
6
  }
7
7
 
8
8
  export interface ConfigurationSchema extends BaseConfitSchema {
9
- trustProxy?: string[];
9
+ trustProxy?: string[] | boolean;
10
10
  logging?: {
11
11
  level?: Level;
12
12
  logHttpRequests?: boolean;
@@ -114,7 +114,9 @@ export async function startApp<
114
114
  app.locals.meter = metrics.getMeterProvider().getMeter(name);
115
115
  setupNodeMetrics(app.locals.meter, {});
116
116
 
117
- if (config.trustProxy) {
117
+ if (config.trustProxy === true) {
118
+ app.enable('trust proxy');
119
+ } else if (config.trustProxy) {
118
120
  app.set('trust proxy', config.trustProxy);
119
121
  }
120
122
 
@@ -63,11 +63,11 @@ function finishLog<SLocals extends AnyServiceLocals = ServiceLocals<Configuratio
63
63
  dur,
64
64
  };
65
65
 
66
- const path = req.route ? req.route.path : null;
66
+ const path = req.route ? { path: req.route.path } : undefined;
67
67
  histogram.record(dur, {
68
68
  status_code: endLog.s,
69
69
  method: endLog.m,
70
- path,
70
+ ...path,
71
71
  service: app.locals.name,
72
72
  });
73
73