Commit 76cee1f 1 parent 924b014 commit 76cee1f Copy full SHA for 76cee1f
File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -273,14 +273,14 @@ function parse (args, opts) {
273
273
274
274
// order of precedence:
275
275
// 1. command line arg
276
- // 2. value from config file
277
- // 3. value from config objects
278
- // 4. value from env var
276
+ // 2. value from env var
277
+ // 3. value from config file
278
+ // 4. value from config objects
279
279
// 5. configured default value
280
280
applyEnvVars ( argv , true ) // special case: check env vars that point to config file
281
+ applyEnvVars ( argv , false )
281
282
setConfig ( argv )
282
283
setConfigObjects ( )
283
- applyEnvVars ( argv , false )
284
284
applyDefaultsAndAliases ( argv , flags . aliases , defaults )
285
285
applyCoercions ( argv )
286
286
Original file line number Diff line number Diff line change @@ -1697,7 +1697,7 @@ describe('yargs-parser', function () {
1697
1697
} )
1698
1698
1699
1699
var jsonPath = path . resolve ( __dirname , './fixtures/config.json' )
1700
- it ( 'should prefer config file value over env var ' , function ( ) {
1700
+ it ( 'should prefer environment variables over config file ' , function ( ) {
1701
1701
process . env . CFG_HERP = 'zerp'
1702
1702
var result = parser ( [ '--cfg' , jsonPath ] , {
1703
1703
envPrefix : 'CFG' ,
@@ -1708,7 +1708,7 @@ describe('yargs-parser', function () {
1708
1708
}
1709
1709
} )
1710
1710
1711
- result . herp . should . equal ( 'derp ' )
1711
+ result . herp . should . equal ( 'zerp ' )
1712
1712
} )
1713
1713
1714
1714
it ( 'should support an env var value as config file option' , function ( ) {
You can’t perform that action at this time.
0 commit comments