Last active
November 25, 2021 05:09
-
-
Save jwarby/c20dd56068431cfbe13c6e2cf108147d to your computer and use it in GitHub Desktop.
Extract Netlify env vars
This file contains hidden or 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
/* Prints env vars from Netlify deploy settings UI to | |
* the JavaScript console. | |
* | |
* Usage: go to the build & deploy settings section of | |
* a Netlify site, then run this script. | |
*/ | |
const envVars = $("#section-environment").querySelectorAll("dl"); | |
const output = [].reduce.call(envVars, (str, dl) => { | |
const name = dl.querySelector("dt").innerText; | |
const value = dl.querySelector("dd").innerText; | |
return str + `${name}=${value}\n`; | |
}, ""); | |
console.log(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: env vars are already sorted on the Netlify UI page so there is no need to implement sorting here.