Skip to content

Commit

Permalink
support CD magic variable
Browse files Browse the repository at this point in the history
  • Loading branch information
endquote committed Apr 3, 2015
1 parent bf4922d commit aec5467
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions server.js
Expand Up @@ -37,6 +37,7 @@ if (configPath && fs.existsSync(configPath)) {
var config = fs.readFileSync(configPath, {encoding:'UTF8'});

// replace environment variables in the config file with their contents
process.env['CD'] = process.cwd();
config = config.replace(/%([^%]+)%/g, function(_,n) {
// also escape slashes
return (process.env[n] + '').replace(/[\\"']/g, '\\$&').replace(/[\\"']/g, '\\$&');
Expand Down

0 comments on commit aec5467

Please sign in to comment.