This will work with the config package.
Created
March 6, 2014 22:43
-
-
Save thanpolas/9401398 to your computer and use it in GitHub Desktop.
Setup Heroku sensitive configs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileOverview Passwords and sensitive shit. | |
*/ | |
var exec = require('child_process').exec; | |
var local = false; | |
var herokuOverride = { | |
cookies: { | |
session: { | |
secret: 'xxx', | |
}, | |
}, | |
crypto: { | |
salt: 'xxx', | |
}, | |
mongo: { | |
user: 'xx', | |
pass: 'xx', | |
hostname: 'xx', | |
}, | |
redis: { | |
main: { | |
host: 'xx', | |
port: 'xxxx', | |
user: 'xx', | |
pass: 'xxx' | |
}, | |
}, | |
mandrill: { | |
apiKey: 'xxx', | |
} | |
}; | |
var jsoned = JSON.stringify(herokuOverride); | |
var re = new RegExp('"', 'g'); | |
var cmd; | |
if (local) { | |
cmd = 'export NODE_CONFIG="'; | |
cmd += jsoned.replace(re, '\\"'); | |
cmd += '"'; | |
} else { | |
cmd = 'heroku config:set NODE_CONFIG="'; | |
cmd += jsoned.replace(re, '\\"'); | |
cmd += '" --app heroku-app'; | |
} | |
console.log('Executing:\n', cmd); | |
exec(cmd, null, function (err, stdout, stderr) { | |
console.log('Finished executing:', err, stdout, stderr); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment