@nib/nconf-transforms

0.1.0 • Public • Published

nconf-transforms

Similar to .NET web.config transforms, nconf-transforms allows you to load nconf configuration files based on convention. By default reads the NODE_ENV environment variable to select what config file to transform. Currently only supports JSON format.

Usage

require('nconf').argv().env() // don't forget to load your environment/argv variables if you want them!

var transform = require('nconf-transforms');

transform({
  dir: './config',
  reload: true // reload nconf when the config file changes
  format: require('nconf-yaml')
});

where your file tree is something like

/app
  app.js
  /config
    settings.json
    settings.production.json

settings.json

{
  "someConfig": "someValue"
}

app.js

var nconf = require('nconf');
console.log(nconf.get('someConfig')); // "someValue"

API

transform(options)

Loads your base configuration and transforms it using the NODE_ENV environment variable to find the transform file.

Options:

  • dir: String. The directory to find the configuration files. Defaults to __dirname, so set it anyway.
  • fileName: String. The name of your configuration files (i.e settings.json, settings.production.json). Defaults to settings
  • reload: Boolean. Toggles reloading of configuration when the base config changes.
  • environment: String. The environment to transform to. Defaults to process.env['NODE_ENV']
  • format: String. The nconf file format to use. Defaults to JSON.

Returns the nconf object so you can chain loading other configuration types/files.

Readme

Keywords

none

Package Sidebar

Install

npm i @nib/nconf-transforms

Weekly Downloads

1

Version

0.1.0

License

none

Last publish

Collaborators

  • nnattawat
  • s.bista
  • aadams-rasa
  • rgstephens
  • abilioh
  • sdarshy
  • smdabrar
  • anylyne
  • pmv-npm
  • aiswaryarajendran
  • kemila-nib
  • dermotosullivannib
  • xunsavior
  • chaulagainajeet
  • daron.robinson
  • davetapsonnib
  • zainab.saif
  • indira.ramachandra
  • williamgonzaleznib
  • shane-w
  • amir.rudd
  • anandmampuzhakal
  • vaanim
  • sarahyapnib
  • varindernib
  • lguan
  • nib-daniel
  • paritoshdhebar_endava
  • fe_nib
  • l.lourenco
  • nicknguyennib2
  • sam-jacobson
  • sanjaydholakiya.nibtravel
  • vinualwisnib
  • sobitha
  • tom-endava
  • satkaur
  • dean-nib
  • brettalcorn
  • steevtee
  • wstolp
  • daniel-nib
  • sachin.patil79
  • phil.a.hawkins
  • csfrank-nib
  • davidvnib
  • ts1654
  • artem.shkumat
  • jezz-jon
  • nib-vish
  • anandmenon
  • jbayer
  • rasberghout
  • tkemp
  • csol94
  • nmaffioldnib
  • zi_choong
  • kim-mckenna-endava
  • xhua026
  • reallandal
  • brodee
  • dlegaspi-nib
  • nadeeth-nib1
  • digio-shanefitzgerald
  • darcymerrickmudbath
  • saranya-nibtravel
  • trentontws
  • krut
  • eddylj
  • georgia-batson
  • adamgonlag
  • paul-neville-thompson
  • terencesunendava
  • nathanpiper-nib
  • sylvia.zh
  • dluong.mud
  • karlb_nz
  • neon-inkblast
  • bencoll
  • amelialuwia
  • cooldesignluke
  • julie.li
  • connorpmcbride
  • tarantoj
  • samreedy
  • caleb.faith
  • shirleyshao
  • kieranjogrady
  • samjwillis-nib
  • nathan.ford-nib
  • sumo_nib
  • domcorso-nib
  • jmatas
  • mthamyeeznib
  • swaff-y
  • nathananstess.nib
  • parisa.heyd
  • stephen.wong
  • thomasc42
  • sameer-e-digio
  • fiona.wang
  • elias.tran.nib
  • pkernaghan
  • ruilunli
  • alankirknibtravel
  • mgw114
  • gaurijadhav
  • sannat-digar
  • bradley.williams
  • sheren
  • ash-tulett-nib
  • damodaran
  • joshgermon-nib
  • joshua.coleiro
  • juliexxvi
  • john.hartmann.nib
  • johnpaulvaughan
  • georgia.batson
  • blakehattingh
  • chris.close.nib
  • dsmitham
  • c.rhind
  • tristancampbellmb
  • danieltran-nib
  • dguilbert
  • tejaswikota
  • tjodzio-nib
  • mitchellharrold
  • billthomas-nib
  • harshahr1994
  • dimi7ri
  • akash.prakash
  • vivien_clifford_nib
  • pallavi.barna
  • bendharvey
  • s.hossain
  • brad.turner
  • scottwalkerau
  • johanjarvi
  • msikkema
  • alunarzewski
  • jnwest
  • mleontieff
  • amy.tait.nib
  • aschofield-nib
  • ian.darroch
  • syed.husain
  • nib-admin
  • lauriejones
  • cmayson
  • ken-ky-wong
  • stribs
  • wng-services
  • eastwood
  • mattbourke
  • narcher
  • tmcclenahan
  • nib-nz-build
  • tgoldthorpe-nib
  • nib-build-agent
  • jackmennienib
  • dariasu
  • bennettsolnet
  • airfan
  • rovacsek
  • gnguyennib
  • tom.mok
  • tbrown-nib
  • vicvinegar
  • oshan.kottege
  • xiaoxinghu
  • rbowen006
  • seanw.nib
  • anishmat27
  • sean0x42
  • zander-mudbath
  • sbeliak-nib
  • c.lassen
  • dmitrymatveev
  • vaishalibhakhar
  • alejop-mudbath
  • r3gm1
  • maraza1721
  • d-martin-nib
  • apnib
  • siyengar94