@platformatic/gateway 3.42.0 → 3.44.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/config.d.ts CHANGED
@@ -818,6 +818,7 @@ export interface PlatformaticGatewayConfig {
818
818
  env?: {
819
819
  [k: string]: string;
820
820
  };
821
+ envfile?: string;
821
822
  sourceMaps?: boolean;
822
823
  nodeModulesSourceMaps?: string[];
823
824
  scheduler?: {
package/lib/proxy.js CHANGED
@@ -2,6 +2,7 @@ import httpProxy from '@fastify/http-proxy'
2
2
  import { ensureLoggableError, loadModule } from '@platformatic/foundation'
3
3
  import fp from 'fastify-plugin'
4
4
  import { createRequire } from 'node:module'
5
+ import { resolve } from 'node:path'
5
6
  import { workerData } from 'node:worker_threads'
6
7
  import { getGlobalDispatcher } from 'undici'
7
8
  import { initMetrics } from './metrics.js'
@@ -19,7 +20,7 @@ function isLocalApplication (application) {
19
20
  return application.origin.endsWith('.plt.local')
20
21
  }
21
22
 
22
- async function resolveApplicationProxyParameters (application) {
23
+ async function resolveApplicationProxyParameters (application, root) {
23
24
  // Get meta information from the application, if any, to eventually hook up to a TCP port
24
25
  // Only fetch meta for local applications - remote applications won't be in the runtime
25
26
  let allMeta = {}
@@ -47,13 +48,15 @@ async function resolveApplicationProxyParameters (application) {
47
48
  internalRewriteLocationHeader = false
48
49
  }
49
50
 
51
+ const require = createRequire(import.meta.filename)
52
+
50
53
  if (application.proxy?.custom) {
51
- const custom = await loadModule(createRequire(import.meta.filename), application.proxy.custom.path)
54
+ const custom = await loadModule(require, resolve(root, application.proxy.custom.path))
52
55
  application.proxy.custom = custom
53
56
  }
54
57
 
55
58
  if (application.proxy?.ws?.hooks) {
56
- const hooks = await loadModule(createRequire(import.meta.filename), application.proxy.ws.hooks.path)
59
+ const hooks = await loadModule(require, resolve(root, application.proxy.ws.hooks.path))
57
60
  application.proxy.ws.hooks = hooks
58
61
  }
59
62
 
@@ -77,6 +80,7 @@ let metrics
77
80
  async function proxyPlugin (app, opts) {
78
81
  const meta = { proxies: {} }
79
82
  const hostnameLessProxies = []
83
+ const root = opts.capability?.root ?? import.meta.dirname
80
84
 
81
85
  for (const application of opts.applications) {
82
86
  if (!application.proxy) {
@@ -87,7 +91,7 @@ async function proxyPlugin (app, opts) {
87
91
  }
88
92
  }
89
93
 
90
- const parameters = await resolveApplicationProxyParameters(application)
94
+ const parameters = await resolveApplicationProxyParameters(application, root)
91
95
  const {
92
96
  prefix,
93
97
  origin,
@@ -181,7 +185,7 @@ async function proxyPlugin (app, opts) {
181
185
  prefix,
182
186
  rewritePrefix,
183
187
  upstream,
184
- preRewrite,
188
+ preRewrite: application.proxy?.custom?.preRewrite ?? preRewrite,
185
189
  preValidation: application.proxy?.custom?.preValidation,
186
190
 
187
191
  websocket: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/gateway",
3
- "version": "3.42.0",
3
+ "version": "3.44.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "typescript": "^5.5.4",
33
33
  "why-is-node-running": "2",
34
34
  "ws": "^8.16.0",
35
- "@platformatic/db": "3.42.0"
35
+ "@platformatic/db": "3.44.0"
36
36
  },
37
37
  "dependencies": {
38
38
  "@fastify/error": "^4.0.0",
@@ -63,11 +63,11 @@
63
63
  "rfdc": "^1.3.1",
64
64
  "semgrator": "^0.3.0",
65
65
  "undici": "^7.0.0",
66
- "@platformatic/foundation": "^3.42.0",
67
- "@platformatic/basic": "3.42.0",
68
- "@platformatic/service": "3.42.0",
69
- "@platformatic/telemetry": "3.42.0",
70
- "@platformatic/scalar-theme": "3.42.0"
66
+ "@platformatic/basic": "3.44.0",
67
+ "@platformatic/foundation": "^3.44.0",
68
+ "@platformatic/scalar-theme": "3.44.0",
69
+ "@platformatic/service": "3.44.0",
70
+ "@platformatic/telemetry": "3.44.0"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/gateway/3.42.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/gateway/3.44.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Gateway Config",
5
5
  "type": "object",
@@ -2955,6 +2955,9 @@
2955
2955
  "type": "string"
2956
2956
  }
2957
2957
  },
2958
+ "envfile": {
2959
+ "type": "string"
2960
+ },
2958
2961
  "sourceMaps": {
2959
2962
  "type": "boolean",
2960
2963
  "default": false