@platformatic/runtime 3.42.0 → 3.43.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
@@ -539,6 +539,7 @@ export type PlatformaticRuntimeConfig = {
539
539
  env?: {
540
540
  [k: string]: string;
541
541
  };
542
+ envfile?: string;
542
543
  sourceMaps?: boolean;
543
544
  nodeModulesSourceMaps?: string[];
544
545
  scheduler?: {
package/index.js CHANGED
@@ -67,6 +67,11 @@ export async function loadConfiguration (configOrRoot, sourceOrConfig, context)
67
67
  root,
68
68
  envFile: context?.envFile
69
69
  })
70
+
71
+ if (config.envfile) {
72
+ context.envFile = config.envfile
73
+ }
74
+
70
75
  const mod = extractModuleFromSchemaUrl(config)
71
76
  if (mod?.module !== '@platformatic/runtime') {
72
77
  return wrapInRuntimeConfig(config, context)
@@ -145,51 +150,24 @@ export async function create (configOrRoot, sourceOrConfig, context) {
145
150
  throw new NodeInspectorFlagsNotSupportedError()
146
151
  }
147
152
 
148
- let runtime = new Runtime(config, context)
153
+ const runtime = new Runtime(config, context)
149
154
  if (setupSignals) {
150
155
  handleSignal(runtime, config)
151
156
  }
152
157
 
153
- // Handle port handling
158
+ // Handle startup
154
159
  if (context?.start) {
155
- let port = config.server?.port
156
-
157
160
  try {
158
161
  await runtime.init()
162
+ if (context.reloaded) {
163
+ runtime.logger.info('The application has been successfully reloaded.')
164
+ }
165
+
166
+ await runtime.start()
159
167
  } catch (err) {
160
168
  await runtime.close()
161
169
  throw err
162
170
  }
163
-
164
- if (context.reloaded) {
165
- runtime.logger.info('The application has been successfully reloaded.')
166
- }
167
-
168
- while (true) {
169
- try {
170
- await runtime.start()
171
- break
172
- } catch (err) {
173
- if ((err.code !== 'EADDRINUSE' && err.code !== 'EACCES') || context?.skipPortInUseHandling) {
174
- throw err
175
- }
176
-
177
- await runtime.close()
178
-
179
- // Get the actual port from the error message if original port was 0
180
- if (!port) {
181
- const mo = err.message.match(/ address already in use (.+)/)
182
- const url = new URL(`http://${mo[1]}`)
183
- port = Number(url.port)
184
- }
185
-
186
- config.server.port = ++port
187
- runtime = new Runtime(config, context)
188
- if (setupSignals) {
189
- handleSignal(runtime, config)
190
- }
191
- }
192
- }
193
171
  }
194
172
 
195
173
  return runtime
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "3.42.0",
3
+ "version": "3.43.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -35,14 +35,14 @@
35
35
  "typescript": "^5.5.4",
36
36
  "undici-oidc-interceptor": "^0.5.0",
37
37
  "why-is-node-running": "^2.2.2",
38
- "@platformatic/composer": "3.42.0",
39
- "@platformatic/db": "3.42.0",
40
- "@platformatic/gateway": "3.42.0",
41
- "@platformatic/node": "3.42.0",
42
- "@platformatic/service": "3.42.0",
43
- "@platformatic/sql-graphql": "3.42.0",
44
- "@platformatic/sql-mapper": "3.42.0",
45
- "@platformatic/wattpm-pprof-capture": "3.42.0"
38
+ "@platformatic/db": "3.43.0",
39
+ "@platformatic/composer": "3.43.0",
40
+ "@platformatic/node": "3.43.0",
41
+ "@platformatic/gateway": "3.43.0",
42
+ "@platformatic/service": "3.43.0",
43
+ "@platformatic/sql-graphql": "3.43.0",
44
+ "@platformatic/sql-mapper": "3.43.0",
45
+ "@platformatic/wattpm-pprof-capture": "3.43.0"
46
46
  },
47
47
  "dependencies": {
48
48
  "@fastify/accepts": "^5.0.0",
@@ -72,12 +72,12 @@
72
72
  "undici": "^7.0.0",
73
73
  "undici-thread-interceptor": "^1.3.1",
74
74
  "ws": "^8.16.0",
75
- "@platformatic/foundation": "3.42.0",
76
- "@platformatic/itc": "3.42.0",
77
- "@platformatic/basic": "3.42.0",
78
- "@platformatic/generators": "3.42.0",
79
- "@platformatic/telemetry": "3.42.0",
80
- "@platformatic/metrics": "3.42.0"
75
+ "@platformatic/basic": "3.43.0",
76
+ "@platformatic/generators": "3.43.0",
77
+ "@platformatic/metrics": "3.43.0",
78
+ "@platformatic/foundation": "3.43.0",
79
+ "@platformatic/telemetry": "3.43.0",
80
+ "@platformatic/itc": "3.43.0"
81
81
  },
82
82
  "engines": {
83
83
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.42.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.43.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Runtime Config",
5
5
  "type": "object",
@@ -2751,6 +2751,9 @@
2751
2751
  "type": "string"
2752
2752
  }
2753
2753
  },
2754
+ "envfile": {
2755
+ "type": "string"
2756
+ },
2754
2757
  "sourceMaps": {
2755
2758
  "type": "boolean",
2756
2759
  "default": false