fastify-rob-config
v1.1.0
Published
Fastify Rob-Config integration
Downloads
667
Readme
fastify-rob-config
Fastify Rob-Config integration
Install
npm i fastify-rob-config
Usage
First, initialize your configuration and schema file: https://github.com/jeromemacias/node-rob-config#rob-config
const fastify = require('fastify')()
const fastifyRobConfig = require('fastify-rob-config')
const config = require('rob-config')
const options = {
confKey: 'config', // optional, default: config
asProperties: false, // if true, you will access to config.key instead of config.get('key'), default: false
config: config // optional, default: require('rob-config')
}
fastify.register(fastifyRobConfig, options, function (err) {
// or fastify[options.confKey].get('env')
console.log(fastify.config.get('env'))
}))
Credits
- convict Featureful configuration management library for Node.js