@platformatic/service 2.8.0-alpha.2 → 2.8.1

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/index.js CHANGED
@@ -184,6 +184,7 @@ async function buildStackable (options, app = platformaticService, Stackable = S
184
184
  }
185
185
 
186
186
  module.exports.configType = 'service'
187
+ module.exports.isPLTService = true
187
188
  module.exports.app = platformaticService
188
189
  module.exports.schema = schema
189
190
  module.exports.buildServer = _buildServer
@@ -18,6 +18,7 @@ async function setupOpenAPI (app, opts) {
18
18
  description: 'This is a service built on top of Platformatic',
19
19
  version: '1.0.0',
20
20
  },
21
+ servers: [{ url: globalThis.platformatic?.runtimeBasePath ?? '/' }],
21
22
  }, typeof openapi === 'object' ? openapi : {})
22
23
  app.log.trace({ openapi: openapiConfig })
23
24
  const swaggerOptions = {
package/lib/stackable.js CHANGED
@@ -3,6 +3,7 @@
3
3
  const { hostname } = require('node:os')
4
4
  const { dirname } = require('node:path')
5
5
  const { pathToFileURL } = require('node:url')
6
+ const { workerData } = require('node:worker_threads')
6
7
  const { printSchema } = require('graphql')
7
8
  const pino = require('pino')
8
9
  const { collectMetrics } = require('@platformatic/metrics')
@@ -26,6 +27,11 @@ class ServiceStackable {
26
27
  this.context.worker ??= { count: 1, index: 0 }
27
28
  this.workerId = this.context.worker.count > 1 ? this.context.worker.index : undefined
28
29
 
30
+ this.runtimeConfig = deepmerge(
31
+ this.context.runtimeConfig ?? {},
32
+ workerData?.config ?? {}
33
+ )
34
+
29
35
  this.configManager.on('error', err => {
30
36
  /* c8 ignore next */
31
37
  this.stackable.log({
@@ -44,7 +50,8 @@ class ServiceStackable {
44
50
  root: this.context.directory ? pathToFileURL(this.context.directory).toString() : undefined,
45
51
  setOpenapiSchema: this.setOpenapiSchema.bind(this),
46
52
  setGraphqlSchema: this.setGraphqlSchema.bind(this),
47
- setBasePath: this.setBasePath.bind(this)
53
+ setBasePath: this.setBasePath.bind(this),
54
+ runtimeBasePath: this.runtimeConfig?.basePath ?? null
48
55
  })
49
56
  }
50
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/service",
3
- "version": "2.8.0-alpha.2",
3
+ "version": "2.8.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -76,14 +76,14 @@
76
76
  "rfdc": "^1.3.1",
77
77
  "semgrator": "^0.3.0",
78
78
  "undici": "^6.9.0",
79
- "@platformatic/client": "2.8.0-alpha.2",
80
- "@platformatic/metrics": "2.8.0-alpha.2",
81
- "@platformatic/config": "2.8.0-alpha.2",
82
- "@platformatic/generators": "2.8.0-alpha.2",
83
- "@platformatic/telemetry": "2.8.0-alpha.2",
84
- "@platformatic/scalar-theme": "2.8.0-alpha.2",
85
- "@platformatic/ts-compiler": "2.8.0-alpha.2",
86
- "@platformatic/utils": "2.8.0-alpha.2"
79
+ "@platformatic/config": "2.8.1",
80
+ "@platformatic/metrics": "2.8.1",
81
+ "@platformatic/generators": "2.8.1",
82
+ "@platformatic/client": "2.8.1",
83
+ "@platformatic/scalar-theme": "2.8.1",
84
+ "@platformatic/telemetry": "2.8.1",
85
+ "@platformatic/ts-compiler": "2.8.1",
86
+ "@platformatic/utils": "2.8.1"
87
87
  },
88
88
  "scripts": {
89
89
  "test": "pnpm run lint && borp -T --concurrency=1 --timeout=300000 && tsd",
package/schema.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/service/2.8.0-alpha.2.json",
3
- "version": "2.8.0-alpha.2",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/service/2.8.1.json",
3
+ "version": "2.8.1",
4
4
  "title": "Platformatic Service",
5
5
  "type": "object",
6
6
  "properties": {