Skip to content

Instantly share code, notes, and snippets.

@TahaBoulehmi
Created September 16, 2022 10:01
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TahaBoulehmi/ef9e8f9123e53590bdefc050c6b568ba to your computer and use it in GitHub Desktop.
Save TahaBoulehmi/ef9e8f9123e53590bdefc050c6b568ba to your computer and use it in GitHub Desktop.
Export Heroku env
// This script lets you export all heroku config vars
// 1) Go to your app settings and reveal config vars
// 2) Open the console and run this code:
// BONUS: You can add this script as a bookmark.
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
var env = ''
Array.from(document.getElementsByTagName('tbody')[0].children).map(item => env += item.children[0].children[0].value + '=' + item.children[1].children[0].value + '\n')
download('env.txt', env);
@TahaBoulehmi
Copy link
Author

Minified:

function download(e,t){var n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),n.setAttribute("download",e),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}var env="";Array.from(document.getElementsByTagName("tbody")[0].children).map(e=>env+=e.children[0].children[0].value+"="+e.children[1].children[0].value+"\n"),download("env.txt",env);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment