configorama 0.5.6 → 0.6.0
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/cli.js +9 -1
- package/package.json +1 -1
- package/src/main.js +11 -0
package/cli.js
CHANGED
|
@@ -8,12 +8,14 @@ const deepLog = require('./src/utils/deep-log')
|
|
|
8
8
|
// Parse command line arguments
|
|
9
9
|
const argv = minimist(process.argv.slice(2), {
|
|
10
10
|
string: ['output', 'o', 'format', 'f'],
|
|
11
|
-
boolean: ['help', 'h', 'version', 'v', 'debug', 'allow-unknown', 'allow-undefined'],
|
|
11
|
+
boolean: ['help', 'h', 'version', 'v', 'debug', 'allow-unknown', 'allow-undefined', 'list', 'info'],
|
|
12
12
|
alias: {
|
|
13
13
|
h: 'help',
|
|
14
14
|
v: 'version',
|
|
15
15
|
o: 'output',
|
|
16
16
|
f: 'format',
|
|
17
|
+
l: 'list',
|
|
18
|
+
i: 'info',
|
|
17
19
|
},
|
|
18
20
|
default: {
|
|
19
21
|
format: 'json'
|
|
@@ -34,11 +36,13 @@ Options:
|
|
|
34
36
|
-o, --output <file> Write output to file instead of stdout
|
|
35
37
|
-f, --format <format> Output format: json, yaml, or js (default: json)
|
|
36
38
|
-d, --debug Enable debug mode
|
|
39
|
+
-i, --info Show info about the config
|
|
37
40
|
--allow-unknown Allow unknown variables to pass through
|
|
38
41
|
--allow-undefined Allow undefined values in the final output
|
|
39
42
|
|
|
40
43
|
Examples:
|
|
41
44
|
configorama config.yml
|
|
45
|
+
configorama --info config.yml
|
|
42
46
|
configorama --format yaml config.json
|
|
43
47
|
configorama --output resolved.json config.yml
|
|
44
48
|
configorama --allow-unknown config.toml
|
|
@@ -88,6 +92,10 @@ if (options.dynamicArgs.verbose) {
|
|
|
88
92
|
version,
|
|
89
93
|
f,
|
|
90
94
|
format,
|
|
95
|
+
list,
|
|
96
|
+
l,
|
|
97
|
+
info,
|
|
98
|
+
i,
|
|
91
99
|
'allow-unknown': allowUnknown,
|
|
92
100
|
'allow-undefined': allowUndefined,
|
|
93
101
|
...rest
|
package/package.json
CHANGED
package/src/main.js
CHANGED
|
@@ -100,6 +100,9 @@ class Configorama {
|
|
|
100
100
|
if (opts && !opts.sync) {
|
|
101
101
|
handleSignalEvents()
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
const showFoundVariables = opts && opts.dynamicArgs && (opts.dynamicArgs.list || opts.dynamicArgs.info)
|
|
105
|
+
|
|
103
106
|
const options = opts || {}
|
|
104
107
|
// Set opts to pass into JS file calls
|
|
105
108
|
this.opts = Object.assign({}, {
|
|
@@ -408,7 +411,9 @@ class Configorama {
|
|
|
408
411
|
console.log()
|
|
409
412
|
deepLog(this.originalConfig)
|
|
410
413
|
console.log()
|
|
414
|
+
}
|
|
411
415
|
|
|
416
|
+
if (VERBOSE || showFoundVariables) {
|
|
412
417
|
const foundVariables = []
|
|
413
418
|
let loggedHeader = false
|
|
414
419
|
traverse(this.originalConfig).forEach(function (rawValue) {
|
|
@@ -1580,6 +1585,12 @@ Unable to resolve configuration variable
|
|
|
1580
1585
|
allowSpecialCase = true
|
|
1581
1586
|
} else if (params && params[variableString]) {
|
|
1582
1587
|
allowSpecialCase = true
|
|
1588
|
+
} else if (variableString === 'ApiGatewayRestApi') {
|
|
1589
|
+
// Allow for "hidden" cloudformation variables, set by sls framework
|
|
1590
|
+
allowSpecialCase = true
|
|
1591
|
+
} else if (variableString === 'HttpApi') {
|
|
1592
|
+
// Allow for "hidden" cloudformation variables, set by sls framework
|
|
1593
|
+
allowSpecialCase = true
|
|
1583
1594
|
}
|
|
1584
1595
|
}
|
|
1585
1596
|
/* Todo handle stage variables */
|