@platformatic/runtime 2.39.1 → 2.41.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
@@ -5,7 +5,7 @@
5
5
  * and run json-schema-to-typescript to regenerate this file.
6
6
  */
7
7
 
8
- export type HttpsSchemasPlatformaticDevPlatformaticRuntime2391Json = {
8
+ export type HttpsSchemasPlatformaticDevPlatformaticRuntime2410Json = {
9
9
  [k: string]: unknown;
10
10
  } & {
11
11
  $schema?: string;
@@ -7,11 +7,15 @@ const errors = require('./errors')
7
7
  const { RoundRobinMap } = require('./worker/round-robin-map')
8
8
 
9
9
  function missingDependencyErrorMessage (clientName, service, services) {
10
- const closestName = closest(clientName, [...services.keys()])
10
+ const allNames = services.map(s => s.id).filter(id => id !== service.id).sort()
11
+ const closestName = closest(clientName, allNames)
11
12
  let errorMsg = `service '${service.id}' has unknown dependency: '${clientName}'.`
12
13
  if (closestName) {
13
14
  errorMsg += ` Did you mean '${closestName}'?`
14
15
  }
16
+ if (allNames.length) {
17
+ errorMsg += ` Known services are: ${allNames.join(', ')}.`
18
+ }
15
19
  return errorMsg
16
20
  }
17
21
 
package/lib/runtime.js CHANGED
@@ -158,10 +158,10 @@ class Runtime extends EventEmitter {
158
158
  }
159
159
 
160
160
  try {
161
- // Make sure the list exists before computing the dependencies, otherwise some services might not be stopped
161
+ checkDependencies(config.services)
162
162
 
163
+ // Make sure the list exists before computing the dependencies, otherwise some services might not be stopped
163
164
  if (autoloadEnabled) {
164
- checkDependencies(config.services)
165
165
  this.#workers = topologicalSort(this.#workers, config)
166
166
  }
167
167
 
package/lib/start.js CHANGED
@@ -29,7 +29,7 @@ async function restartRuntime (runtime) {
29
29
  }
30
30
 
31
31
  async function buildRuntime (configManager, env) {
32
- env = env || process.env
32
+ env = env || Object.assign({}, process.env, configManager.env)
33
33
 
34
34
  if (inspector.url() && !env.VSCODE_INSPECTOR_OPTIONS) {
35
35
  throw new errors.NodeInspectorFlagsNotSupportedError()
@@ -105,15 +105,19 @@ async function main () {
105
105
  const service = workerData.serviceConfig
106
106
 
107
107
  // Load env file and mixin env vars from service config
108
+ let envfile
108
109
  if (service.envfile) {
109
- const envfile = resolve(workerData.dirname, service.envfile)
110
- globalThis.platformatic.logger.info({ envfile }, 'Loading envfile...')
111
-
112
- dotenv.config({
113
- path: envfile
114
- })
110
+ envfile = resolve(workerData.dirname, service.envfile)
111
+ } else {
112
+ envfile = resolve(workerData.serviceConfig.path, '.env')
115
113
  }
116
114
 
115
+ globalThis.platformatic.logger.debug({ envfile }, 'Loading envfile...')
116
+
117
+ dotenv.config({
118
+ path: envfile
119
+ })
120
+
117
121
  if (config.env) {
118
122
  Object.assign(process.env, config.env)
119
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "2.39.1",
3
+ "version": "2.41.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -36,12 +36,12 @@
36
36
  "typescript": "^5.5.4",
37
37
  "undici-oidc-interceptor": "^0.5.0",
38
38
  "why-is-node-running": "^2.2.2",
39
- "@platformatic/composer": "2.39.1",
40
- "@platformatic/db": "2.39.1",
41
- "@platformatic/node": "2.39.1",
42
- "@platformatic/service": "2.39.1",
43
- "@platformatic/sql-graphql": "2.39.1",
44
- "@platformatic/sql-mapper": "2.39.1"
39
+ "@platformatic/composer": "2.41.0",
40
+ "@platformatic/node": "2.41.0",
41
+ "@platformatic/service": "2.41.0",
42
+ "@platformatic/db": "2.41.0",
43
+ "@platformatic/sql-graphql": "2.41.0",
44
+ "@platformatic/sql-mapper": "2.41.0"
45
45
  },
46
46
  "dependencies": {
47
47
  "@fastify/accepts": "^5.0.0",
@@ -75,13 +75,13 @@
75
75
  "undici": "^7.0.0",
76
76
  "undici-thread-interceptor": "^0.11.0",
77
77
  "ws": "^8.16.0",
78
- "@platformatic/basic": "2.39.1",
79
- "@platformatic/config": "2.39.1",
80
- "@platformatic/generators": "2.39.1",
81
- "@platformatic/itc": "2.39.1",
82
- "@platformatic/telemetry": "2.39.1",
83
- "@platformatic/utils": "2.39.1",
84
- "@platformatic/ts-compiler": "2.39.1"
78
+ "@platformatic/basic": "2.41.0",
79
+ "@platformatic/config": "2.41.0",
80
+ "@platformatic/generators": "2.41.0",
81
+ "@platformatic/itc": "2.41.0",
82
+ "@platformatic/telemetry": "2.41.0",
83
+ "@platformatic/ts-compiler": "2.41.0",
84
+ "@platformatic/utils": "2.41.0"
85
85
  },
86
86
  "scripts": {
87
87
  "test": "npm run lint && borp --concurrency=1 --timeout=300000 && tsd",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/runtime/2.39.1.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/runtime/2.41.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "type": "object",
5
5
  "properties": {