@platformatic/service 0.5.1 → 0.6.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.
@@ -0,0 +1,8 @@
1
+ server:
2
+ hostname: "127.0.0.1"
3
+ port: 0
4
+ plugin:
5
+ path: "./plugin.js"
6
+ options:
7
+ something: 'else'
8
+ metrics: false
@@ -0,0 +1,7 @@
1
+ 'use default'
2
+
3
+ module.exports = async function (app, opts) {
4
+ app.get('/', async () => {
5
+ return opts
6
+ })
7
+ }
package/lib/schema.js CHANGED
@@ -151,6 +151,9 @@ const plugin = {
151
151
  }
152
152
  },
153
153
  additionalProperties: false
154
+ },
155
+ options: {
156
+ type: 'object'
154
157
  }
155
158
  },
156
159
  required: ['path']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/service",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Matteo Collina <hello@matteocollina.com>",
@@ -34,8 +34,8 @@
34
34
  "@fastify/static": "^6.5.0",
35
35
  "@fastify/swagger": "^8.0.0",
36
36
  "@fastify/under-pressure": "^8.0.0",
37
- "@platformatic/config": "0.5.1",
38
- "@platformatic/utils": "0.5.1",
37
+ "@platformatic/config": "0.6.0",
38
+ "@platformatic/utils": "0.6.0",
39
39
  "close-with-grace": "^1.1.0",
40
40
  "commist": "^3.1.2",
41
41
  "desm": "^1.2.0",
@@ -45,7 +45,7 @@
45
45
  "fastify": "^4.6.0",
46
46
  "fastify-metrics": "^10.0.0",
47
47
  "fastify-plugin": "^4.1.0",
48
- "fastify-sandbox": "^0.9.0",
48
+ "fastify-sandbox": "^0.10.0",
49
49
  "graphql": "^16.6.0",
50
50
  "help-me": "^4.1.0",
51
51
  "mercurius": "^11.3.0",
@@ -17,7 +17,14 @@ test('autostart', async ({ equal, same, match, teardown }) => {
17
17
  })
18
18
 
19
19
  test('start command', async ({ equal, same, match, teardown }) => {
20
- const { child } = await start('start', '-c', join(import.meta.url, '..', '..', 'fixtures', 'hello', 'platformatic.service.json'))
20
+ const { child, url } = await start('start', '-c', join(import.meta.url, '..', '..', 'fixtures', 'hello', 'platformatic.service.json'))
21
+
22
+ const res = await request(`${url}`)
23
+ equal(res.statusCode, 200)
24
+ const body = await res.body.json()
25
+ match(body, {
26
+ hello: 'world'
27
+ }, 'response')
21
28
 
22
29
  child.kill('SIGINT')
23
30
  })
@@ -27,3 +34,16 @@ test('default logger', async ({ equal, same, match, teardown }) => {
27
34
  match(url, /http:\/\/127.0.0.1:[0-9]+/)
28
35
  child.kill('SIGINT')
29
36
  })
37
+
38
+ test('plugin options', async ({ equal, same, match, teardown }) => {
39
+ const { child, url } = await start('-c', join(import.meta.url, '..', '..', 'fixtures', 'options', 'platformatic.service.yml'))
40
+
41
+ const res = await request(`${url}`)
42
+ equal(res.statusCode, 200)
43
+ const body = await res.body.json()
44
+ match(body, {
45
+ something: 'else'
46
+ }, 'response')
47
+
48
+ child.kill('SIGINT')
49
+ })