Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeromemacias/fastify-rob-config
Fastify Rob-Config integration
https://github.com/jeromemacias/fastify-rob-config
Last synced: 25 days ago
JSON representation
Fastify Rob-Config integration
- Host: GitHub
- URL: https://github.com/jeromemacias/fastify-rob-config
- Owner: jeromemacias
- License: mit
- Created: 2018-02-12T15:03:52.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T17:46:45.000Z (about 2 years ago)
- Last Synced: 2024-11-24T02:16:17.573Z (about 2 months ago)
- Language: JavaScript
- Size: 1.37 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-fastify - `fastify-rob-config` - Config integration. (<h2 align="center">Awesome Fastify</h2> / <h2 align="center">Ecosystem</h2>)
README
# fastify-rob-config
Fastify Rob-Config integration
[![Current Version](https://img.shields.io/npm/v/fastify-rob-config.svg)](https://www.npmjs.com/package/fastify-rob-config)
[![Build Status](https://travis-ci.org/jeromemacias/fastify-rob-config.svg?branch=master)](https://travis-ci.org/jeromemacias/fastify-rob-config)## Install
```
npm i fastify-rob-config
```
## UsageFirst, initialize your configuration and schema file: https://github.com/jeromemacias/node-rob-config#rob-config
```js
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](https://github.com/mozilla/node-convict) Featureful configuration management library for Node.js