Skip to content
This repository has been archived by the owner on Nov 16, 2019. It is now read-only.

Commit

Permalink
reinstate support for upper-case npm_config_* environment variables
Browse files Browse the repository at this point in the history
This fixes a regression introduced in e5dcca4.
  • Loading branch information
davidchambers committed Jul 4, 2014
1 parent de58f59 commit 016b298
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion npmconf.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ Conf.prototype.addEnv = function (env) {

// leave first char untouched, even if
// it is a "_" - convert all other to "-"
var p = k.replace(/^npm_config_/, '')
var p = k.toLowerCase()
.replace(/^npm_config_/, '')
.replace(/(?!^)_/g, '-')
conf[p] = env[k]
})
Expand Down
3 changes: 3 additions & 0 deletions test/00-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ process.env.npm_config_userconfig = exports.userconfig
process.env.npm_config_other_env_thing = 1000
process.env.random_env_var = 'asdf'
process.env.npm_config__underbar_env_thing = 'underful'
process.env.NPM_CONFIG_UPPERCASE_ENV_THING = 42

exports.envData = {
userconfig: exports.userconfig,
'_underbar-env-thing': 'underful',
'uppercase-env-thing': '42',
'other-env-thing': '1000'
}
exports.envDataFix = {
userconfig: exports.userconfig,
'_underbar-env-thing': 'underful',
'uppercase-env-thing': 42,
'other-env-thing': 1000,
}

Expand Down

0 comments on commit 016b298

Please sign in to comment.