Skip to content

Instantly share code, notes, and snippets.

@thanpolas
Created Mar 6, 2014
Embed
What would you like to do?
Setup Heroku sensitive configs
/**
* @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