Fastify Rob-Config integration
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
.editorconfig
.eslintignore
.eslintrc.json
.gitignore
.prettierignore
.prettierrc
.travis.yml
LICENSE
README.md
index.js
package-lock.json
package.json
test.js

README.md

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