What’s New

server 1.0.16

1.0.16

Added hook for options within a plugin options so you can have a subschema in a plugin option schema. Example:

// For the plugin @server/auth
module.exports = {
  name: 'auth',
  callback: { type: String },
  options: {
    facebook: {

      // Note: these 2 should be not needed in the future
      default: {},
      extend: true,

      // This is the new thing that you can do:
      options: {
        id: { type: String, env: 'FACEBOOK_ID' },
        secret: { type: String, env: 'FACEBOOK_SECRET' }
      }

    }
  }
};

Then when using the plugin it will be like this:

server({
  auth: {
    facebook: {
      id: 'whatever',
      secret: 'whatever'
    }
  }
});

But of course for this specific example you'd use the .env:

# .env
FACEBOOK_ID=whatever
FACEBOOK_SECRET=whatever
View original