senecajs / seneca

A microservices toolkit for Node.js.
http://senecajs.org
MIT License
3.95k stars 314 forks source link

plugin.defaults can be a function, called before anything else, returning the defaults object #940

Open rjrodger opened 1 month ago

rjrodger commented 1 month ago

this allows the default options to be build dynamically

also allows passing in seneca, and thus gubu, maintaining version matching

function myplugin(options) { ... }
myplugin.defaults = (seneca)=>{
  const { Open } = seneca.valid
  return Open({
    settingA: 1
  })
}