Skip to content

Instantly share code, notes, and snippets.

@nmnp
Created February 12, 2018 06:00
Show Gist options
  • Save nmnp/f2f1fa3bf2902837267cee9dbef7054e to your computer and use it in GitHub Desktop.
Save nmnp/f2f1fa3bf2902837267cee9dbef7054e to your computer and use it in GitHub Desktop.
Generate JSON string of environment variables of a wercker pipeline
var envVar = {};
var tr = Array.from(
document.querySelectorAll("table")[0].querySelectorAll('tbody')[0].querySelectorAll('tr'));
tr.map((el)=>{
var tmp = [];
tmp[el.querySelectorAll('.envvarItem_key')[0].querySelectorAll('input')[0].value] = el.querySelectorAll('td')[1].querySelectorAll('.envvarItem_value')[0].querySelectorAll('.envvarItem_value_container')[0].querySelectorAll('textarea')[0].value;
envVar = Object.assign(envVar, tmp);
}
);
console.log(JSON.stringify(envVar));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment