Follow

Follow

Platformatic v0.6.0 - Options, Auth, and NULL!

Matteo Collina's photo
Matteo Collina
·Nov 9, 2022·

2 min read

We are using Platformatic to build something new that we find missing features we need all the time. v0.6.0 release adds a couple of new things!

The full release notes are available at: github.com/platformatic/platformatic/releas..

While I was preparing this blog post, I stumbled a bug, which I fixed in v0.6.1:

github.com/platformatic/platformatic/releas..

Setting the plugin options

It's now possible to configure the options for the custom plugins defined in Platformatic Service & DB.

Given the following config file:

server:
  hostname: 127.0.0.1
  port: 3000
plugin:
  path: ./plugin.mjs
  options:
    hello: 'Hello World'

and plugin

export default async function (app, opts) {
  // opts will contain anything defined in plugin -> options
  app.get('/', () => opts.hello)
}

You can see it in action at:

Skipping authorization

In custom plugins, it's possible to skip the authorization rules on entities programmatically by setting the skipAuth flag to true, e.g.:

// this works even if the user's role doesn't have the `find` permission
const res = await app.platformatic.entities.page.find({
  ctx, // The context contain the user information
  skipAuth: true
})

is NULL support

In Platformatic DB, filtering by fields being NULL is now possible. This feature should have been in from the start - it's my fault ;).

Screenshot 2022-11-09 at 18.11.13.png

 
Share this