Commit graph

137 commits

Author SHA1 Message Date
Adrien Becchis
b8686aeff0 Migrating test to jest ()
* set up jest dependencies

* add parser option to eslint to support es6

* migrate first test to jest

* migrate the argv test to shpec

* convert the env and literal store tests

* convert the file-store tests

* convert the memory-store tests

* convert the hierarchy tests

* convert the provider-save test

* convert the complete test

* convert the provider test

* convert the conf test

* tweak a test that was no longer working (context changed)

* replace in place the helpers file

* remove vows dependency

* update the test invocation to rely on jest

* update the argv test to be able to use the jest --verbose option

* Some tweaks to the test to have them working

* Update node version tested (+10 +12 -9)

* Replace const by var until we drop 0.10/0.12/4 node

* Replace let by var until we drop 0.10/0.12/4 node
2019-04-29 22:26:02 -04:00
louis-murray
391665cc38 Enable writes env and argv stores with a flag ()
* added fucntionality to toggle readonly for env store

* fixed issue with using lint

* updated readme to reflect env options change

* updated tests to better test readOnly property

* added fucntionality to toggle readonly for env store

* fixed issue with using lint

* updated readme to reflect env options change

* updated tests to better test readOnly property

* updated tests to fix issues.

* updated argv to have readOnly toggle-able

* added tests for argv toggle-able readonly
2017-11-12 23:11:01 -05:00
bryce-gibson
b6699aba2d Don't do array lookups on strings. ()
`hasOwnProperty(number)` can return true for strings.

This is unlikely to be the desired usage, and can mean that odd
responses are returned by nconf.

Disable trying to check `hasOwnProperty` of strings.
2017-11-04 21:39:00 -04:00
Adrien Becchis
467ab753c8 Regex as env separator ()
* use regexp as env separator (support shorthand specification)

* add test to cover the env separator
2017-11-04 21:30:56 -04:00
Adrien Becchis
e5db2ef6d7 Argv store separator ()
* argv store now accept a separator argument to create nested values

* remove stub file that shouldnt have been commited

* write a test to ensure separator is working well and use delete rather than undefined assign
2017-11-04 21:30:14 -04:00
Ahmed Ayoub
3607767f90 fixes chainable .required() ()
* fixes  chainable .required()

* fixes  use var instead of let for travis builds
2017-11-04 00:34:27 -04:00
Adrien Becchis
2bdf7e1a32 Clean Argv Store options ()
* unset parse/transform from options and ensure they are not yargs options

* use delete rather than undefined assignement
2017-11-03 23:41:23 -04:00
Adrien Becchis
b9321b200a transformer can now return an undefined key () 2017-11-03 23:22:13 -04:00
Augusto Franzoia
b1ee63cfa4 fix error in transform function when dealing with dropped entries () 2017-10-31 17:12:31 -04:00
Adrien Becchis
b41c505c6e Save conf to dedicated file ()
* Added support for saving configuration to a specific file

Added support for saving configuration to a specific file

* add test to cover the save to file feature

* add posibility to specify a format to save to file

* add a test with nconf-yaml to ensure specifying a format works
2017-10-30 10:01:55 -04:00
AdrieanKhisbe
802a8d623f test for yargs custom instance (more flexible check isYargs) 2017-10-28 17:13:38 -04:00
Nicolas Deveaud
3e26bb2756 Add posibility to pass a yargs instance to argv() method 2017-10-28 17:13:38 -04:00
Matt Hamann
856fdf8dff First pass at transform functions () 2017-10-25 22:57:58 -04:00
Matt Hamann
b9c345bf96 Fix parseValues option name 2017-10-21 21:58:30 -04:00
Matt Hamann
35088a3313 Added nconf.any method ()
* Added nconf.any method

Fixes 
Implemented on the Provider class
Takes an array of keys, or a variable argument list
Supports both callback and non-callback invocations

* Use an explicit search base in file store test

Fixes 
Test file was created under process.env.HOME, but test was searching in
the current working directory. If the cwd was not on the same drive as
the home directory, the test would fail.

* Added some API documentation to README for 'any'

* Tweak `.any` documentation
2017-10-21 16:42:24 -04:00
Matt Hamann
ca10d0eaf8 Add basic linting rules 2017-10-21 16:01:06 -04:00
Brian Harrington
bfb0220fe1 Remove unused module ()
crypto is no longer used in file.js
2017-10-21 15:47:41 -04:00
Matt Hamann
532ac9cc57 Support parsing simple values from env/argv strings ()
* simple parse, 

* documentation for tryParse option

* Combine JSON parsing and simple parsing
2017-10-21 15:39:16 -04:00
Matt Hamann
b8402d4eab Enable support for parsing JSON environment variables ()
* Add support for applying JSON string

* only take JSON Object or JSON Array into consideration

* Add tests and make JSON-parsing opt-in
2017-09-27 16:32:26 -04:00
Jan Klosinski
392c6022c9 Copy process.env before lower-casing the keys
`process.env` is read-only in GitBash (and potentially other consoles),
so the `lowerCase` flag had no effect.
2016-03-01 17:08:35 +00:00
Jarrett Cruger
4431c33162 [fix] handle buffers so we dont get ambiguous errors when we dont strictly read the file as utf8 2016-02-02 16:38:48 -08:00
Jarrett Cruger
b447268097 [fix] cleanup secure with new module 2016-02-01 22:21:15 -08:00
Wojtek Turyn
37a84ae8df required() method 2015-10-15 10:16:33 +02:00
indexzero
86bfd7c5bc [fix] Do not trim \n from files read in. 2015-10-07 15:31:53 -04:00
indexzero
11b2448471 [fix] Correct property path. Trim read secret keys from disk. 2015-10-02 01:00:55 -07:00
Charlie Robbins
e503718468 Merge pull request from indexzero/fix-redis
Fix some minor consistency issues in Redis
2015-09-20 01:14:43 -07:00
indexzero
4b5030dbc2 [fix] Only merge actual objects, not null values. Fixes . 2015-09-20 01:10:37 -07:00
Rob Rodriguez
a3589fab95 Fixing provider issue in source 2015-09-20 01:08:45 -07:00
Rob Rodriguez
51653e6486 Passing the value parameter to the providers
The nconf-redis provider needs the value for some reason, if its absent
this call will fail. It should be there anyway.
2015-09-20 01:07:21 -07:00
indexzero
0358545ae5 [test api] Make the format capable of sub-objects. 2015-09-20 00:26:34 -07:00
indexzero
04c0f3a001 [api test] Encrypt individual keys instead of entire stringified contents. Added basic unit tests. 2015-09-19 00:12:50 -07:00
indexzero
442d2b4233 [api] Allow for secure to be simply a secret string. 2015-09-18 20:52:16 -07:00
indexzero
2de2bc0b66 [api] Allow for "secure" option to be passed to nconf.stores.File to perform content encryption / decryption with crypto.createCipher. 2015-09-18 20:52:16 -07:00
Jarrett Cruger
54f2287dd8 Merge pull request from olalonde/master
env({lowerCase:true}) option to make it possible to get() keys in lower case
2015-09-17 18:46:27 -07:00
Christian Murphy
5d95f13eb0 filter out undefined values 2015-08-19 09:16:16 -07:00
Remy Sharp
3c11ef50e5 fix: env.match test
The previous test was expecting the .match value to be a function rather than a regexp which is what the README shows. So I've fixed the code to match against a real regexp, and test if the stringified version of the regexp function is [object RegExp].

I've also updated the tests to prime the process.env with values that are specifically tested for to ensure it's correctly loading the env values.

Fixex 
2015-08-04 10:30:33 -07:00
Olivier Lalonde
8a21ef36d5 env({lowerCase:true}) option to make it possible to get() keys in lower case 2015-08-04 18:56:43 +08:00
Christian Murphy
80ec01b91d replace optimist with yargs 2015-07-07 13:06:41 -07:00
Jarrett Cruger
87a3b82418 [fix] we shouldnt be reversing here fixes 2014-11-26 12:51:33 -05:00
indexzero
af0e9fb7e7 [dist fix] Cleanup some whitespace. 2014-11-26 01:31:48 -05:00
indexzero
09342555ba [fix] Fixed regression introduced by . 2014-11-26 01:28:31 -05:00
indexzero
8d5fb25701 [fix] Fix my own sloppy coding fixing the sloppy coding from . 2014-11-26 01:14:44 -05:00
Charlie Robbins
5502f2cf98 Merge pull request from martinheidegger/patch-1
Adding helpful information in case parsing failed.
2014-11-26 01:08:02 -05:00
indexzero
f07bc40d64 [fix] Fix inconsistent style from . 2014-11-26 01:06:44 -05:00
Charlie Robbins
d5bd26c0b6 Merge pull request from joaoafrmartins/master
filter process.env by regexp
2014-11-26 01:06:11 -05:00
Charlie Robbins
c6d8f5d140 Merge pull request from jfromaniello/master
Use optionally a different separator for memorystore
2014-11-26 01:04:35 -05:00
indexzero
f771500266 [dist] Semantic cleanup from sloppy coding in . 2014-11-26 01:02:59 -05:00
Charlie Robbins
a3404b4062 Merge pull request from jmonster/usage
Resolves , usage and help
2014-11-26 00:59:36 -05:00
Martin Heidegger
c8b6c98c7a Adding helpful information in case parsing failed.
I stumbled over 2 slight problems of broken configuration files:

1) It said that a error in my JSON file existed (even though it was a yaml file, parsed by libyaml)
2) It didn't tell me which error occured.

both should be fixed with this PR
2014-03-09 21:40:10 +09:00
Christopher Jeffrey
8105c761ad [fix] only reverse keys for "get" action to be safe. 2014-02-12 12:32:34 -06:00