Backup Heroku Config Vars

I wrote a simple website scraping script to get a backup of a Heroku app’s Config Variables.

Step 1: Load jQuery into the Chrome Console

Check out our post on loading jQuery in the Chrome Console at https://blog.wplauncher.com/run-jquery-in-chrome-console/

Step 2: Pull out the Config Keys and Config Values associated with the Heroku Config Vars

Now that you have loaded jQuery in the chrome console, you need to run the following jQuery function that pulls out the keys and values associated with the config variables and spits them into the console. Please note this was written in July 2019 so the classes mentioned below may change if Heroku updates their site. Those values should now be present in your console and you can copy them and save them somewhere really safe or use them with PHP dotenv in another project.

function saveHerokuConfigVars(){
var config_var = '';
var config_var_length = $('.config-var-item').length;
	var config_key = $(this).find('.config-var-key').val();
	var config_value = $(this).find('.config-var-value').val();
	config_var = config_key+':'+config_value;

Leave a Reply

Your email address will not be published. Required fields are marked *