github graphile/crystal v3.5.0
pgSettings function

latest releases: v4.14.0, v4.13.0, v4.12.12...
6 years ago

Thanks to @explicitcall in #556, the pgSettings library option can now accept a function which returns settings to add to the PostgreSQL transaction. An example of using this might be something like:

app.use(
  postgraphql(process.env.DATABASE_URL, 'public', {
    pgSettings: req => ({
      'user.id': `${req.session.user_id}`,
    }),
  })
)

Be very careful when using this that you don't open yourself to cross-site request forgery (CSRF) security issues.

Thanks also to @vitaly-t for updating our version of pg-minify.


Version 4 is just around the corner with some significant memory usage and performance improvements, plugin support and more! For a list of breaking changes and to try it out, pop over to #506. Help testing it is greatly appreciated - please let us know whether or not it works for you (positive signals are important here too!).

Don't miss a new crystal release

NewReleases is sending notifications on new releases.