diff options
-rw-r--r-- | lib/utils/ini.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/utils/ini.js b/lib/utils/ini.js index 48d4f99ed..b033b6a04 100644 --- a/lib/utils/ini.js +++ b/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] }) } |