@platformatic/service 0.47.2 → 0.47.5
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 +1 -1
- package/lib/schema.js +1 -3
- package/lib/start.js +17 -16
- package/package.json +6 -6
package/index.js
CHANGED
package/lib/schema.js
CHANGED
|
@@ -328,8 +328,7 @@ const server = {
|
|
|
328
328
|
},
|
|
329
329
|
cors
|
|
330
330
|
},
|
|
331
|
-
additionalProperties: false
|
|
332
|
-
required: ['hostname', 'port']
|
|
331
|
+
additionalProperties: false
|
|
333
332
|
}
|
|
334
333
|
|
|
335
334
|
const watch = {
|
|
@@ -635,7 +634,6 @@ const platformaticServiceSchema = {
|
|
|
635
634
|
clients
|
|
636
635
|
},
|
|
637
636
|
additionalProperties: false,
|
|
638
|
-
required: ['server'],
|
|
639
637
|
$defs: openApiDefs
|
|
640
638
|
}
|
|
641
639
|
|
package/lib/start.js
CHANGED
|
@@ -41,11 +41,15 @@ async function buildServer (options, app) {
|
|
|
41
41
|
|
|
42
42
|
async function createRestartable (fastify) {
|
|
43
43
|
const config = configManager.current
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
let fastifyOptions = {}
|
|
45
|
+
if (config.server) {
|
|
46
|
+
fastifyOptions = {
|
|
47
|
+
...config.server
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
fastifyOptions.genReqId = function (req) { return randomUUID() }
|
|
48
51
|
|
|
52
|
+
const root = fastify(fastifyOptions)
|
|
49
53
|
root.decorate('platformatic', { configManager, config })
|
|
50
54
|
root.register(app)
|
|
51
55
|
|
|
@@ -62,25 +66,22 @@ async function buildServer (options, app) {
|
|
|
62
66
|
return root
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
if (options.server) {
|
|
70
|
+
if (options.server.https) {
|
|
71
|
+
options.server.https.key = await adjustHttpsKeyAndCert(options.server.https.key)
|
|
72
|
+
options.server.https.cert = await adjustHttpsKeyAndCert(options.server.https.cert)
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
|
-
|
|
72
75
|
const handler = await restartable(createRestartable)
|
|
73
|
-
|
|
76
|
+
handler.decorate('start', async () => {
|
|
77
|
+
url = await handler.listen({ host: options.server?.hostname || '127.0.0.1', port: options.server?.port || 0 })
|
|
78
|
+
return url
|
|
79
|
+
})
|
|
74
80
|
configManager.on('error', function (err) {
|
|
75
81
|
/* c8 ignore next 1 */
|
|
76
82
|
handler.log.error({ err }, 'error reloading the configuration')
|
|
77
83
|
})
|
|
78
84
|
|
|
79
|
-
handler.decorate('start', async () => {
|
|
80
|
-
url = await handler.listen({ host: hostname, port })
|
|
81
|
-
return url
|
|
82
|
-
})
|
|
83
|
-
|
|
84
85
|
return handler
|
|
85
86
|
}
|
|
86
87
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/service",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"pino-pretty": "^10.0.0",
|
|
68
68
|
"rfdc": "^1.3.0",
|
|
69
69
|
"ua-parser-js": "^1.0.35",
|
|
70
|
-
"@platformatic/client": "0.47.
|
|
71
|
-
"@platformatic/config": "0.47.
|
|
72
|
-
"@platformatic/swagger-ui-theme": "0.47.
|
|
73
|
-
"@platformatic/telemetry": "0.47.
|
|
74
|
-
"@platformatic/utils": "0.47.
|
|
70
|
+
"@platformatic/client": "0.47.5",
|
|
71
|
+
"@platformatic/config": "0.47.5",
|
|
72
|
+
"@platformatic/swagger-ui-theme": "0.47.5",
|
|
73
|
+
"@platformatic/telemetry": "0.47.5",
|
|
74
|
+
"@platformatic/utils": "0.47.5"
|
|
75
75
|
},
|
|
76
76
|
"standard": {
|
|
77
77
|
"ignore": [
|