@platformatic/service 1.36.0 → 1.36.2

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
@@ -217,13 +217,9 @@ export interface PlatformaticService {
217
217
  prefix?: string;
218
218
  path?: string;
219
219
  };
220
- plugins?:
221
- | {
222
- [k: string]: unknown;
223
- }
224
- | {
225
- [k: string]: unknown;
226
- };
220
+ plugins?: {
221
+ [k: string]: unknown;
222
+ };
227
223
  }[];
228
224
  };
229
225
  }
package/lib/start.js CHANGED
@@ -3,9 +3,10 @@
3
3
  const { readFile } = require('fs/promises')
4
4
  const close = require('close-with-grace')
5
5
  const { loadConfig, ConfigManager, printConfigValidationErrors, printAndExitLoadConfigError } = require('@platformatic/config')
6
- const { addLoggerToTheConfig } = require('./utils.js')
6
+ const { addLoggerToTheConfig, isDocker } = require('./utils.js')
7
7
  const { restartable } = require('@fastify/restartable')
8
8
  const { randomUUID } = require('crypto')
9
+
9
10
  async function adjustHttpsKeyAndCert (arg) {
10
11
  if (typeof arg === 'string') {
11
12
  return arg
@@ -47,13 +48,17 @@ async function buildServer (options, app) {
47
48
  async function createRestartable (fastify) {
48
49
  const config = configManager.current
49
50
  let fastifyOptions = {}
51
+
50
52
  if (config.server) {
53
+ // override hostname if it's docker
54
+ if (await isDocker()) {
55
+ config.server.hostname = '0.0.0.0'
56
+ }
51
57
  fastifyOptions = {
52
58
  ...config.server
53
59
  }
54
60
  }
55
61
  fastifyOptions.genReqId = function (req) { return randomUUID() }
56
-
57
62
  const root = fastify(fastifyOptions)
58
63
  root.decorate('platformatic', { configManager, config })
59
64
  await root.register(app)
package/lib/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const { access } = require('node:fs/promises')
3
+ const { access, readFile, stat } = require('node:fs/promises')
4
4
  const { resolve, join, relative, dirname, basename } = require('node:path')
5
5
  const { isatty } = require('tty')
6
6
 
@@ -190,7 +190,35 @@ function changeOpenapiSchemaPrefix (openapiSchema, oldVersionPrefix, newVersionP
190
190
  }
191
191
  }
192
192
 
193
+ let isDockerCached
194
+
195
+ async function isDocker () {
196
+ async function hasDockerEnv () {
197
+ try {
198
+ await stat('/.dockerenv')
199
+ return true
200
+ } catch {
201
+ return false
202
+ }
203
+ }
204
+
205
+ async function hasDockerCGroup () {
206
+ try {
207
+ return (await readFile('/proc/self/cgroup', 'utf8')).includes('docker')
208
+ } catch {
209
+ return false
210
+ }
211
+ }
212
+
213
+ if (isDockerCached === undefined) {
214
+ isDockerCached = await hasDockerEnv() || await hasDockerCGroup()
215
+ }
216
+
217
+ return isDockerCached
218
+ }
219
+
193
220
  module.exports = {
221
+ isDocker,
194
222
  isFileAccessible,
195
223
  getJSPluginPath,
196
224
  addLoggerToTheConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/service",
3
- "version": "1.36.0",
3
+ "version": "1.36.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -20,8 +20,8 @@
20
20
  "@fastify/aws-lambda": "^4.0.0",
21
21
  "@fastify/compress": "^7.0.0",
22
22
  "bindings": "^1.5.0",
23
- "borp": "^0.11.0",
24
- "json-schema-to-typescript": "^13.1.2",
23
+ "borp": "^0.12.0",
24
+ "json-schema-to-typescript": "^14.0.0",
25
25
  "openapi-types": "^12.1.3",
26
26
  "pino-abstract-transport": "^1.1.0",
27
27
  "self-cert": "^2.0.0",
@@ -73,18 +73,18 @@
73
73
  "openapi-schema-diff": "^0.0.1",
74
74
  "ora": "^6.3.1",
75
75
  "pino": "^8.19.0",
76
- "pino-pretty": "^10.3.1",
76
+ "pino-pretty": "^11.0.0",
77
77
  "rfdc": "^1.3.1",
78
78
  "semgrator": "^0.3.0",
79
79
  "ua-parser-js": "^1.0.37",
80
80
  "undici": "^6.9.0",
81
- "@platformatic/authenticate": "1.36.0",
82
- "@platformatic/generators": "1.36.0",
83
- "@platformatic/scalar-theme": "1.36.0",
84
- "@platformatic/config": "1.36.0",
85
- "@platformatic/telemetry": "1.36.0",
86
- "@platformatic/utils": "1.36.0",
87
- "@platformatic/client": "1.36.0"
81
+ "@platformatic/authenticate": "1.36.2",
82
+ "@platformatic/config": "1.36.2",
83
+ "@platformatic/client": "1.36.2",
84
+ "@platformatic/generators": "1.36.2",
85
+ "@platformatic/scalar-theme": "1.36.2",
86
+ "@platformatic/telemetry": "1.36.2",
87
+ "@platformatic/utils": "1.36.2"
88
88
  },
89
89
  "standard": {
90
90
  "ignore": [
package/schema.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "$id": "https://platformatic.dev/schemas/v1.36.0/service",
3
- "version": "1.36.0",
2
+ "$id": "https://platformatic.dev/schemas/v1.36.2/service",
3
+ "version": "1.36.2",
4
4
  "title": "Platformatic Service",
5
5
  "type": "object",
6
6
  "properties": {