diff options
Diffstat (limited to 'deps/npm/lib/utils/ini.js')
-rw-r--r-- | deps/npm/lib/utils/ini.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/deps/npm/lib/utils/ini.js b/deps/npm/lib/utils/ini.js index 48d4f99edf..b033b6a04d 100644 --- a/deps/npm/lib/utils/ini.js +++ b/deps/npm/lib/utils/ini.js @@ -323,8 +323,14 @@ function envReplace (f) { if (typeof f !== "string" || !f) return f // replace any ${ENV} values with the appropriate environ. - return f.replace(/\$\{([^}]+)\}/g, function (orig, name, i, s) { - return process.env[name] || orig + var envExpr = /(\\*)\$\{([^}]+)\}/g + return f.replace(envExpr, function (orig, esc, name, i, s) { + esc = esc.length && esc.length % 2 + if (esc) return orig + if (undefined === process.env[name]) { + throw new Error("Failed to replace env in config: "+orig) + } + return process.env[name] }) } |