fastify-rob-config

Fastify Rob-Config integration

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
fastify-rob-config
1121.1.02 years ago5 years agoMinified + gzip package size for fastify-rob-config in KB

Readme

fastify-rob-config
Fastify Rob-Config integration
Current Version Build Status

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