config 3.3.4 → 3.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/History.md +20 -4
- package/LICENSE +1 -1
- package/README.md +25 -25
- package/lib/config.js +50 -32
- package/package.json +7 -4
- package/parser.js +6 -2
package/History.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
3.3.7 / 2022-01-11
|
|
2
|
+
==================
|
|
3
|
+
|
|
4
|
+
* No new changes. 3.3.6 was not published to NPM in versioning mix-up.
|
|
5
|
+
* Release notes are moving to Github Releases page going forward.
|
|
6
|
+
|
|
7
|
+
3.3.6 / 2021-03-08
|
|
8
|
+
==================
|
|
9
|
+
|
|
10
|
+
* Added publishConfig element to package.json to prevent publishing to the wrong repository - @lorenwest
|
|
11
|
+
|
|
12
|
+
3.3.5 / 2021-03-05
|
|
13
|
+
==================
|
|
14
|
+
|
|
15
|
+
* FIX [#628](https://github.com/node-config/node-config/issues/628) Uncaught ReferenceError: node_env_var_name is not defined @prnake
|
|
16
|
+
|
|
1
17
|
3.3.4 / 2021-02-26
|
|
2
18
|
==================
|
|
3
19
|
|
|
@@ -328,7 +344,7 @@ and you're not trying to mutate config arrays.
|
|
|
328
344
|
* Simplify syntax for defer() functions. The 'this' value in the functions is now bound
|
|
329
345
|
to the main configuration object, so it doesn't have to be passed into the function. (@markstos)
|
|
330
346
|
* new defer sub-module introduced in 1.8.0 can now be accessed by require('config/defer')
|
|
331
|
-
For usage, see: https://github.com/
|
|
347
|
+
For usage, see: https://github.com/node-config/node-config/wiki/Configuration-Files#javascript-module---js
|
|
332
348
|
* Add test coverage for array merging cases. (@markstos)
|
|
333
349
|
* Bump dependency on cson package to 1.6.1 (@markstos)
|
|
334
350
|
|
|
@@ -336,7 +352,7 @@ and you're not trying to mutate config arrays.
|
|
|
336
352
|
==================
|
|
337
353
|
|
|
338
354
|
* Added deferred function for evaluating configs after load (@markstos)
|
|
339
|
-
For details, see: https://github.com/
|
|
355
|
+
For details, see: https://github.com/node-config/node-config/wiki/Configuration-Files#javascript-module---js
|
|
340
356
|
* Bumped js-yaml dependency (@markstos)
|
|
341
357
|
|
|
342
358
|
1.7.0 / 2014-10-30
|
|
@@ -421,7 +437,7 @@ and you're not trying to mutate config arrays.
|
|
|
421
437
|
===================
|
|
422
438
|
|
|
423
439
|
* Major revision. Upgrade notes:
|
|
424
|
-
https://github.com/
|
|
440
|
+
https://github.com/node-config/node-config/wiki/Upgrading-From-Config-0.x
|
|
425
441
|
* Update to semver versioning
|
|
426
442
|
* Change load ordering
|
|
427
443
|
from hostname.EXT --> deployment.EXT
|
|
@@ -440,7 +456,7 @@ and you're not trying to mutate config arrays.
|
|
|
440
456
|
* Removed reliance on global.NODE_CONFIG so older versions can work with 1.x
|
|
441
457
|
* Fix empty YAML file causing crash with latest js-yaml
|
|
442
458
|
* Added SUPPRESS_NO_CONFIG_WARNING for better sub-module support
|
|
443
|
-
* Moved all documentation [to the wiki](https://github.com/
|
|
459
|
+
* Moved all documentation [to the wiki](https://github.com/node-config/node-config/wiki).
|
|
444
460
|
|
|
445
461
|
0.4.37 / 2014-07-22
|
|
446
462
|
===================
|
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2010-
|
|
1
|
+
// Copyright 2010-2022, Loren West and other contributors
|
|
2
2
|
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
// of this software and associated documentation files (the "Software"), to
|
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@ Configure your Node.js Applications
|
|
|
2
2
|
===================================
|
|
3
3
|
|
|
4
4
|
[](https://nodei.co/npm/config/)
|
|
5
|
-
[](https://travis-ci.org/lorenwest/node-config)
|
|
6
|
+
[release notes](https://github.com/node-config/node-config/blob/master/History.md)
|
|
7
7
|
|
|
8
8
|
Introduction
|
|
9
9
|
------------
|
|
@@ -14,8 +14,8 @@ It lets you define a set of default parameters,
|
|
|
14
14
|
and extend them for different deployment environments (development, qa,
|
|
15
15
|
staging, production, etc.).
|
|
16
16
|
|
|
17
|
-
Configurations are stored in [configuration files](https://github.com/
|
|
18
|
-
[command line parameters](https://github.com/
|
|
17
|
+
Configurations are stored in [configuration files](https://github.com/node-config/node-config/wiki/Configuration-Files) within your application, and can be overridden and extended by [environment variables](https://github.com/lorenwest/node-config/wiki/Environment-Variables),
|
|
18
|
+
[command line parameters](https://github.com/node-config/node-config/wiki/Command-Line-Overrides), or [external sources](https://github.com/lorenwest/node-config/wiki/Configuring-from-an-External-Source).
|
|
19
19
|
|
|
20
20
|
This gives your application a consistent configuration interface shared among a
|
|
21
21
|
[growing list of npm modules](https://www.npmjs.org/browse/depended/config) also using node-config.
|
|
@@ -31,7 +31,7 @@ Project Guidelines
|
|
|
31
31
|
|
|
32
32
|
Quick Start
|
|
33
33
|
---------------
|
|
34
|
-
The following examples are in JSON format, but configurations can be in other [file formats](https://github.com/
|
|
34
|
+
The following examples are in JSON format, but configurations can be in other [file formats](https://github.com/node-config/node-config/wiki/Configuration-Files#file-formats).
|
|
35
35
|
|
|
36
36
|
**Install in your app directory, and edit the default config file.**
|
|
37
37
|
|
|
@@ -108,29 +108,29 @@ come from the `production.json` override file.
|
|
|
108
108
|
Articles
|
|
109
109
|
--------
|
|
110
110
|
|
|
111
|
-
* [Configuration Files](https://github.com/
|
|
112
|
-
* [Special features for JavaScript configuration files](https://github.com/
|
|
113
|
-
* [Common Usage](https://github.com/
|
|
114
|
-
* [Environment Variables](https://github.com/
|
|
115
|
-
* [Reserved Words](https://github.com/
|
|
116
|
-
* [Command Line Overrides](https://github.com/
|
|
117
|
-
* [Multiple Node Instances](https://github.com/
|
|
118
|
-
* [Sub-Module Configuration](https://github.com/
|
|
119
|
-
* [Configuring from a DB / External Source](https://github.com/
|
|
120
|
-
* [Securing Production Config Files](https://github.com/
|
|
121
|
-
* [External Configuration Management Tools](https://github.com/
|
|
122
|
-
* [Examining Configuration Sources](https://github.com/
|
|
123
|
-
* [Using Config Utilities](https://github.com/
|
|
124
|
-
* [Upgrading from Config 0.x](https://github.com/
|
|
125
|
-
* [Webpack usage](https://github.com/
|
|
111
|
+
* [Configuration Files](https://github.com/node-config/node-config/wiki/Configuration-Files)
|
|
112
|
+
* [Special features for JavaScript configuration files](https://github.com/node-config/node-config/wiki/Special-features-for-JavaScript-configuration-files)
|
|
113
|
+
* [Common Usage](https://github.com/node-config/node-config/wiki/Common-Usage)
|
|
114
|
+
* [Environment Variables](https://github.com/node-config/node-config/wiki/Environment-Variables)
|
|
115
|
+
* [Reserved Words](https://github.com/node-config/node-config/wiki/Reserved-Words)
|
|
116
|
+
* [Command Line Overrides](https://github.com/node-config/node-config/wiki/Command-Line-Overrides)
|
|
117
|
+
* [Multiple Node Instances](https://github.com/node-config/node-config/wiki/Multiple-Node-Instances)
|
|
118
|
+
* [Sub-Module Configuration](https://github.com/node-config/node-config/wiki/Sub-Module-Configuration)
|
|
119
|
+
* [Configuring from a DB / External Source](https://github.com/node-config/node-config/wiki/Configuring-from-an-External-Source)
|
|
120
|
+
* [Securing Production Config Files](https://github.com/node-config/node-config/wiki/Securing-Production-Config-Files)
|
|
121
|
+
* [External Configuration Management Tools](https://github.com/node-config/node-config/wiki/External-Configuration-Management-Tools)
|
|
122
|
+
* [Examining Configuration Sources](https://github.com/node-config/node-config/wiki/Examining-Configuration-Sources)
|
|
123
|
+
* [Using Config Utilities](https://github.com/node-config/node-config/wiki/Using-Config-Utilities)
|
|
124
|
+
* [Upgrading from Config 0.x](https://github.com/node-config/node-config/wiki/Upgrading-From-Config-0.x)
|
|
125
|
+
* [Webpack usage](https://github.com/node-config/node-config/wiki/Webpack-Usage)
|
|
126
126
|
|
|
127
127
|
Further Information
|
|
128
128
|
---------------------
|
|
129
129
|
If you still don't see what you are looking for, here are some more resources to check:
|
|
130
130
|
|
|
131
|
-
* The [wiki may have more pages](https://github.com/
|
|
131
|
+
* The [wiki may have more pages](https://github.com/node-config/node-config/wiki) which are not directly linked from here.
|
|
132
132
|
* Review [questions tagged with node-config](https://stackexchange.com/filters/207096/node-config) on StackExchange. These are monitored by `node-config` contributors.
|
|
133
|
-
* [Search the issue tracker](https://github.com/
|
|
133
|
+
* [Search the issue tracker](https://github.com/node-config/node-config/issues). Hundreds of issues have already been discussed and resolved there.
|
|
134
134
|
|
|
135
135
|
Contributors
|
|
136
136
|
------------
|
|
@@ -169,8 +169,8 @@ Contributors
|
|
|
169
169
|
License
|
|
170
170
|
-------
|
|
171
171
|
|
|
172
|
-
May be freely distributed under the [MIT license](https://raw.githubusercontent.com/
|
|
172
|
+
May be freely distributed under the [MIT license](https://raw.githubusercontent.com/node-config/node-config/master/LICENSE).
|
|
173
173
|
|
|
174
|
-
Copyright (c) 2010-
|
|
175
|
-
[and other contributors](https://github.com/
|
|
174
|
+
Copyright (c) 2010-2022 Loren West
|
|
175
|
+
[and other contributors](https://github.com/node-config/node-config/graphs/contributors)
|
|
176
176
|
|
package/lib/config.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
// config.js (c) 2010-
|
|
1
|
+
// config.js (c) 2010-2022 Loren West and other contributors
|
|
2
2
|
// May be freely distributed under the MIT license.
|
|
3
3
|
// For further details and documentation:
|
|
4
4
|
// http://lorenwest.github.com/node-config
|
|
5
5
|
|
|
6
6
|
// Dependencies
|
|
7
|
-
var
|
|
8
|
-
DeferredConfig = require('../defer').DeferredConfig,
|
|
7
|
+
var DeferredConfig = require('../defer').DeferredConfig,
|
|
9
8
|
RawConfig = require('../raw').RawConfig,
|
|
10
9
|
Parser = require('../parser'),
|
|
11
10
|
Utils = require('util'),
|
|
@@ -14,12 +13,10 @@ var deferConfig = require('../defer').deferConfig,
|
|
|
14
13
|
|
|
15
14
|
// Static members
|
|
16
15
|
var DEFAULT_CLONE_DEPTH = 20,
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
CONFIG_DIR, NODE_ENV, APP_INSTANCE,
|
|
17
|
+
CONFIG_SKIP_GITCRYPT, NODE_ENV_VAR_NAME,
|
|
19
18
|
NODE_CONFIG_PARSER,
|
|
20
19
|
env = {},
|
|
21
|
-
privateUtil = {},
|
|
22
|
-
deprecationWarnings = {},
|
|
23
20
|
configSources = [], // Configuration sources - array of {name, original, parsed}
|
|
24
21
|
checkMutability = true, // Check for mutability/immutability on first get
|
|
25
22
|
gitCryptTestRegex = /^.GITCRYPT/; // regular expression to test for gitcrypt files.
|
|
@@ -410,19 +407,28 @@ util.makeImmutable = function(object, property, value) {
|
|
|
410
407
|
value: Object.freeze(value)
|
|
411
408
|
});
|
|
412
409
|
} else {
|
|
410
|
+
// Call recursively if an object.
|
|
411
|
+
if (util.isObject(value)) {
|
|
412
|
+
// Create a proxy, to capture user updates of configuration options, and throw an exception for awareness, as per:
|
|
413
|
+
// https://github.com/lorenwest/node-config/issues/514
|
|
414
|
+
value = new Proxy(util.makeImmutable(value), {
|
|
415
|
+
set (target, name) {
|
|
416
|
+
const message = (Reflect.has(target, name) ? 'update' : 'add');
|
|
417
|
+
// Notify the user.
|
|
418
|
+
throw Error(`Can not ${message} runtime configuration property: "${name}". Configuration objects are immutable unless ALLOW_CONFIG_MUTATIONS is set.`)
|
|
419
|
+
}
|
|
420
|
+
})
|
|
421
|
+
}
|
|
422
|
+
|
|
413
423
|
Object.defineProperty(object, propertyName, {
|
|
414
424
|
value: value,
|
|
415
425
|
writable : false,
|
|
416
426
|
configurable: false
|
|
417
427
|
});
|
|
418
428
|
|
|
419
|
-
// Ensure new properties can not be added
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
// Call recursively if an object.
|
|
423
|
-
if (util.isObject(value)) {
|
|
424
|
-
util.makeImmutable(value);
|
|
425
|
-
}
|
|
429
|
+
// Ensure new properties can not be added, as per:
|
|
430
|
+
// https://github.com/lorenwest/node-config/issues/505
|
|
431
|
+
Object.preventExtensions(object[propertyName])
|
|
426
432
|
}
|
|
427
433
|
}
|
|
428
434
|
|
|
@@ -542,7 +548,7 @@ util.loadFileConfigs = function(configDir, options) {
|
|
|
542
548
|
var node_env_var_names = ['NODE_CONFIG_ENV', 'NODE_ENV'];
|
|
543
549
|
|
|
544
550
|
// Loop through the variables to try and set environment
|
|
545
|
-
for (node_env_var_name of node_env_var_names) {
|
|
551
|
+
for (const node_env_var_name of node_env_var_names) {
|
|
546
552
|
NODE_ENV = util.initParam(node_env_var_name);
|
|
547
553
|
if (!!NODE_ENV) {
|
|
548
554
|
NODE_ENV_VAR_NAME = node_env_var_name;
|
|
@@ -562,25 +568,21 @@ util.loadFileConfigs = function(configDir, options) {
|
|
|
562
568
|
// Split files name, for loading multiple files.
|
|
563
569
|
NODE_ENV = NODE_ENV.split(',');
|
|
564
570
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
CONFIG_DIR = Path.join(process.cwd() , CONFIG_DIR);
|
|
568
|
-
}
|
|
571
|
+
var dir = configDir || util.initParam('NODE_CONFIG_DIR', Path.join( process.cwd(), 'config') );
|
|
572
|
+
dir = _toAbsolutePath(dir);
|
|
569
573
|
|
|
570
574
|
APP_INSTANCE = util.initParam('NODE_APP_INSTANCE');
|
|
571
|
-
HOST = util.initParam('HOST');
|
|
572
|
-
HOSTNAME = util.initParam('HOSTNAME');
|
|
573
575
|
CONFIG_SKIP_GITCRYPT = util.initParam('CONFIG_SKIP_GITCRYPT');
|
|
574
576
|
|
|
575
577
|
// This is for backward compatibility
|
|
576
|
-
|
|
578
|
+
var runtimeFilename = util.initParam('NODE_CONFIG_RUNTIME_JSON', Path.join(dir , 'runtime.json') );
|
|
577
579
|
|
|
578
580
|
NODE_CONFIG_PARSER = util.initParam('NODE_CONFIG_PARSER');
|
|
579
581
|
if (NODE_CONFIG_PARSER) {
|
|
580
582
|
try {
|
|
581
583
|
var parserModule = Path.isAbsolute(NODE_CONFIG_PARSER)
|
|
582
584
|
? NODE_CONFIG_PARSER
|
|
583
|
-
: Path.join(
|
|
585
|
+
: Path.join(dir, NODE_CONFIG_PARSER);
|
|
584
586
|
Parser = require(parserModule);
|
|
585
587
|
}
|
|
586
588
|
catch (e) {
|
|
@@ -589,6 +591,9 @@ util.loadFileConfigs = function(configDir, options) {
|
|
|
589
591
|
}
|
|
590
592
|
}
|
|
591
593
|
|
|
594
|
+
var HOST = util.initParam('HOST');
|
|
595
|
+
var HOSTNAME = util.initParam('HOSTNAME');
|
|
596
|
+
|
|
592
597
|
// Determine the host name from the OS module, $HOST, or $HOSTNAME
|
|
593
598
|
// Remove any . appendages, and default to null if not set
|
|
594
599
|
try {
|
|
@@ -639,7 +644,7 @@ util.loadFileConfigs = function(configDir, options) {
|
|
|
639
644
|
});
|
|
640
645
|
});
|
|
641
646
|
|
|
642
|
-
var locatedFiles = util.locateMatchingFiles(
|
|
647
|
+
var locatedFiles = util.locateMatchingFiles(dir, allowedFiles);
|
|
643
648
|
locatedFiles.forEach(function(fullFilename) {
|
|
644
649
|
var configObj = util.parseFile(fullFilename, options);
|
|
645
650
|
if (configObj) {
|
|
@@ -651,6 +656,9 @@ util.loadFileConfigs = function(configDir, options) {
|
|
|
651
656
|
// NODE_CONFIG only applies to the base config
|
|
652
657
|
if (!configDir) {
|
|
653
658
|
var envConfig = {};
|
|
659
|
+
|
|
660
|
+
CONFIG_DIR = dir;
|
|
661
|
+
|
|
654
662
|
if (process.env.NODE_CONFIG) {
|
|
655
663
|
try {
|
|
656
664
|
envConfig = JSON.parse(process.env.NODE_CONFIG);
|
|
@@ -690,11 +698,11 @@ util.loadFileConfigs = function(configDir, options) {
|
|
|
690
698
|
}
|
|
691
699
|
|
|
692
700
|
// Override with environment variables if there is a custom-environment-variables.EXT mapping file
|
|
693
|
-
var customEnvVars = util.getCustomEnvVars(
|
|
701
|
+
var customEnvVars = util.getCustomEnvVars(dir, extNames);
|
|
694
702
|
util.extendDeep(config, customEnvVars);
|
|
695
703
|
|
|
696
704
|
// Extend the original config with the contents of runtime.json (backwards compatibility)
|
|
697
|
-
var runtimeJson = util.parseFile(
|
|
705
|
+
var runtimeJson = util.parseFile(runtimeFilename) || {};
|
|
698
706
|
util.extendDeep(config, runtimeJson);
|
|
699
707
|
|
|
700
708
|
util.resolveDeferredConfigs(config);
|
|
@@ -718,6 +726,7 @@ util.locateMatchingFiles = function(configDirs, allowedFiles) {
|
|
|
718
726
|
return configDirs.split(Path.delimiter)
|
|
719
727
|
.reduce(function(files, configDir) {
|
|
720
728
|
if (configDir) {
|
|
729
|
+
configDir = _toAbsolutePath(configDir);
|
|
721
730
|
try {
|
|
722
731
|
FileSystem.readdirSync(configDir).forEach(function(file) {
|
|
723
732
|
if (allowedFiles[file]) {
|
|
@@ -1084,12 +1093,12 @@ util.substituteDeep = function (substitutionMap, variables) {
|
|
|
1084
1093
|
for (var prop in map) {
|
|
1085
1094
|
var value = map[prop];
|
|
1086
1095
|
if (typeof(value) === 'string') { // We found a leaf variable name
|
|
1087
|
-
if (vars[value] !== undefined) { // if the vars provide a value set the value in the result map
|
|
1096
|
+
if (vars[value] !== undefined && vars[value] !== '') { // if the vars provide a value set the value in the result map
|
|
1088
1097
|
util.setPath(result, pathTo.concat(prop), vars[value]);
|
|
1089
1098
|
}
|
|
1090
1099
|
}
|
|
1091
1100
|
else if (util.isObject(value)) { // work on the subtree, giving it a clone of the pathTo
|
|
1092
|
-
if ('__name' in value && '__format' in value && vars[value.__name] !== undefined) {
|
|
1101
|
+
if ('__name' in value && '__format' in value && vars[value.__name] !== undefined && vars[value.__name] !== '') {
|
|
1093
1102
|
try {
|
|
1094
1103
|
var parsedValue = util.parseString(vars[value.__name], value.__format);
|
|
1095
1104
|
} catch(err) {
|
|
@@ -1118,18 +1127,18 @@ util.substituteDeep = function (substitutionMap, variables) {
|
|
|
1118
1127
|
*
|
|
1119
1128
|
* @protected
|
|
1120
1129
|
* @method getCustomEnvVars
|
|
1121
|
-
* @param
|
|
1130
|
+
* @param configDir {string} - the passed configuration directory
|
|
1122
1131
|
* @param extNames {Array[string]} - acceptable configuration file extension names.
|
|
1123
1132
|
* @returns {object} - mapped environment variables or {} if there are none
|
|
1124
1133
|
*/
|
|
1125
|
-
util.getCustomEnvVars = function (
|
|
1134
|
+
util.getCustomEnvVars = function (configDir, extNames) {
|
|
1126
1135
|
var result = {};
|
|
1127
1136
|
var resolutionIndex = 1;
|
|
1128
1137
|
var allowedFiles = {};
|
|
1129
1138
|
extNames.forEach(function (extName) {
|
|
1130
1139
|
allowedFiles['custom-environment-variables' + '.' + extName] = resolutionIndex++;
|
|
1131
1140
|
});
|
|
1132
|
-
var locatedFiles = util.locateMatchingFiles(
|
|
1141
|
+
var locatedFiles = util.locateMatchingFiles(configDir, allowedFiles);
|
|
1133
1142
|
locatedFiles.forEach(function (fullFilename) {
|
|
1134
1143
|
var configObj = util.parseFile(fullFilename);
|
|
1135
1144
|
if (configObj) {
|
|
@@ -1476,7 +1485,7 @@ util.runStrictnessChecks = function (config) {
|
|
|
1476
1485
|
function _warnOrThrow (msg) {
|
|
1477
1486
|
var beStrict = process.env.NODE_CONFIG_STRICT_MODE;
|
|
1478
1487
|
var prefix = beStrict ? 'FATAL: ' : 'WARNING: ';
|
|
1479
|
-
var seeURL = 'See https://github.com/
|
|
1488
|
+
var seeURL = 'See https://github.com/node-config/node-config/wiki/Strict-Mode';
|
|
1480
1489
|
|
|
1481
1490
|
console.error(prefix+msg);
|
|
1482
1491
|
console.error(prefix+seeURL);
|
|
@@ -1488,6 +1497,15 @@ util.runStrictnessChecks = function (config) {
|
|
|
1488
1497
|
}
|
|
1489
1498
|
};
|
|
1490
1499
|
|
|
1500
|
+
// Helper functions shared accross object members
|
|
1501
|
+
function _toAbsolutePath (configDir) {
|
|
1502
|
+
if (configDir.indexOf('.') === 0) {
|
|
1503
|
+
return Path.join(process.cwd(), configDir);
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
return configDir;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1491
1509
|
// Instantiate and export the configuration
|
|
1492
1510
|
var config = module.exports = new Config();
|
|
1493
1511
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "config",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.8",
|
|
4
4
|
"main": "./lib/config.js",
|
|
5
5
|
"description": "Configuration control for production node deployments",
|
|
6
6
|
"author": "Loren West <open_source@lorenwest.com>",
|
|
7
|
-
"homepage": "http://
|
|
7
|
+
"homepage": "http://github.com/node-config/node-config.git",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"registry": "https://registry.npmjs.org/"
|
|
10
|
+
},
|
|
8
11
|
"keywords": [
|
|
9
12
|
"conf",
|
|
10
13
|
"config",
|
|
@@ -19,7 +22,7 @@
|
|
|
19
22
|
},
|
|
20
23
|
"license": "MIT",
|
|
21
24
|
"dependencies": {
|
|
22
|
-
"json5": "^2.
|
|
25
|
+
"json5": "^2.2.1"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
|
25
28
|
"@types/node": "^7.0.8",
|
|
@@ -38,7 +41,7 @@
|
|
|
38
41
|
},
|
|
39
42
|
"repository": {
|
|
40
43
|
"type": "git",
|
|
41
|
-
"url": "http://github.com/
|
|
44
|
+
"url": "http://github.com/node-config/node-config.git"
|
|
42
45
|
},
|
|
43
46
|
"engines": {
|
|
44
47
|
"node": ">= 10.0.0"
|
package/parser.js
CHANGED
|
@@ -55,6 +55,7 @@ Parser.tsParser = function(filename, content) {
|
|
|
55
55
|
if (!require.extensions['.ts']) {
|
|
56
56
|
require(TS_DEP).register({
|
|
57
57
|
lazy: true,
|
|
58
|
+
transpileOnly: true,
|
|
58
59
|
compilerOptions: {
|
|
59
60
|
allowJs: true,
|
|
60
61
|
}
|
|
@@ -62,7 +63,7 @@ Parser.tsParser = function(filename, content) {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
// Imports config if it is exported via module.exports = ...
|
|
65
|
-
// See https://github.com/
|
|
66
|
+
// See https://github.com/node-config/node-config/issues/524
|
|
66
67
|
var configObject = require(filename);
|
|
67
68
|
|
|
68
69
|
// Because of ES6 modules usage, `default` is treated as named export (like any other)
|
|
@@ -136,7 +137,10 @@ Parser.yamlParser = function(filename, content) {
|
|
|
136
137
|
// The yaml library doesn't like strings that have newlines but don't
|
|
137
138
|
// end in a newline: https://github.com/visionmedia/js-yaml/issues/issue/13
|
|
138
139
|
content += '\n';
|
|
139
|
-
|
|
140
|
+
if (typeof VisionmediaYaml.eval === 'function') {
|
|
141
|
+
return VisionmediaYaml.eval(Parser.stripYamlComments(content));
|
|
142
|
+
}
|
|
143
|
+
return VisionmediaYaml.parse(Parser.stripYamlComments(content));
|
|
140
144
|
}
|
|
141
145
|
else {
|
|
142
146
|
console.error('No YAML parser loaded. Suggest adding js-yaml dependency to your package.json file.')
|