@trojs/openapi-server 1.16.0 → 1.17.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@trojs/openapi-server",
3
3
  "description": "OpenAPI Server",
4
- "version": "1.16.0",
4
+ "version": "1.17.0",
5
5
  "author": {
6
6
  "name": "Pieter Wigboldus",
7
7
  "url": "https://trojs.org/"
package/src/server.js CHANGED
@@ -4,6 +4,7 @@ import compression from 'compression'
4
4
  import helmet from 'helmet'
5
5
  import * as Sentry from '@sentry/node'
6
6
  import bodyParser from 'body-parser'
7
+ import { hostname } from 'node:os'
7
8
  import { openAPI } from './openapi.js'
8
9
  import { Api } from './api.js'
9
10
 
@@ -53,6 +54,8 @@ const getOriginResourcePolicy = (origin) => ({
53
54
  * @property {number=} tracesSampleRate
54
55
  * @property {number=} profilesSampleRate
55
56
  * @property {string=} release
57
+ * @property {string=} environment
58
+ * @property {string=} serverName
56
59
  */
57
60
 
58
61
  /**
@@ -88,13 +91,15 @@ export const setupServer = async ({
88
91
  if (sentry) {
89
92
  Sentry.init({
90
93
  dsn: sentry.dsn,
94
+ environment: sentry.environment || process.env.NODE_ENV || 'production',
91
95
  integrations: [
92
96
  new Sentry.Integrations.Http({ tracing: true }),
93
97
  new Sentry.Integrations.Express({ app })
94
98
  ],
95
99
  tracesSampleRate: sentry.tracesSampleRate || 1.0,
96
100
  profilesSampleRate: sentry.profilesSampleRate || 1.0,
97
- release: sentry.release
101
+ release: sentry.release || process.env.SOURCE_VERSION,
102
+ serverName: sentry.serverName || process.env.SERVER_NAME || hostname()
98
103
  })
99
104
 
100
105
  app.use(Sentry.Handlers.requestHandler())
package/types/server.d.ts CHANGED
@@ -32,6 +32,8 @@ export type SentryConfig = {
32
32
  tracesSampleRate?: number | undefined;
33
33
  profilesSampleRate?: number | undefined;
34
34
  release?: string | undefined;
35
+ environment?: string | undefined;
36
+ serverName?: string | undefined;
35
37
  };
36
38
  import { openAPI } from './openapi.js';
37
39
  import { Api } from './api.js';
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.js"],"names":[],"mappings":"AAuEO,qHAVJ;IAA4B,IAAI,EAAxB,SAAS,EAAE;IACK,MAAM,GAAtB,MAAM,YAAC;IACS,YAAY,GAA5B,MAAM,YAAC;IACe,MAAM,GAA5B,YAAY,YAAC;IACG,SAAS,GAAzB,MAAM,YAAC;IACS,OAAO,GAAvB,MAAM,YAAC;IACQ,UAAU,GAAzB,GAAG,EAAE,YAAC;IACiB,eAAe,GAAtC,CAAA,MAAM,GAAC,MAAM,aAAC;CACtB,GAAU,OAAO,CAAC;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,CAAC,CA4DrC;sBAtGY,OAAO,2BAA2B,EAAE,OAAO;uBAC3C,OAAO,2BAA2B,EAAE,QAAQ;sBAC5C,OAAO,iBAAiB,EAAE,OAAO;wBACjC,OAAO,UAAU,EAAE,SAAS;qBAC5B,OAAO,UAAU,EAAE,MAAM;;uBAKxB,CAAC;cAED,OAAO,YAAC;cACR,OAAO,YAAC;eACR,QAAQ,YAAC;iBACT,MAAM,YAAC;oBACP,MAAM,YAAC;WACP,CAAC,YAAC;UACF,MAAM,YAAC;aACP,MAAM,YAAC;WACP,MAAM,YAAC;;;UAKP,MAAM,YAAC;uBACP,MAAM,YAAC;yBACP,MAAM,YAAC;cACP,MAAM,YAAC;;wBAhDG,cAAc;oBAClB,UAAU"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.js"],"names":[],"mappings":"AA0EO,qHAVJ;IAA4B,IAAI,EAAxB,SAAS,EAAE;IACK,MAAM,GAAtB,MAAM,YAAC;IACS,YAAY,GAA5B,MAAM,YAAC;IACe,MAAM,GAA5B,YAAY,YAAC;IACG,SAAS,GAAzB,MAAM,YAAC;IACS,OAAO,GAAvB,MAAM,YAAC;IACQ,UAAU,GAAzB,GAA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