Skip to content

Instantly share code, notes, and snippets.

@daltonmenezes
Last active October 4, 2023 04:41
Show Gist options
  • Save daltonmenezes/d67f587fb893a36a1a6b1f1b43cb1ae4 to your computer and use it in GitHub Desktop.
Save daltonmenezes/d67f587fb893a36a1a6b1f1b43cb1ae4 to your computer and use it in GitHub Desktop.
Get/Export Vercel envs script
;(async () => {
const TIMEOUT_MS = 700
const delay = () => new Promise((resolve) => setTimeout(resolve, TIMEOUT_MS))
const revealButtons = document.querySelectorAll('button[aria-label="Click to reveal"]')
for (revealButton of revealButtons) {
revealButton.click()
await delay()
}
await delay()
const envKeys = [...document.querySelectorAll('span > span[class*="env-variables-"]')].map((key) => key.textContent)
const enValues = [...document.querySelectorAll('button > code[class*="env-var-value"]')].map((key) => key.textContent)
const envs = envKeys.reduce((acc, key, index) => {
envKeys[index] = enValues[index]
acc += `${key}="${enValues[index]}"\n`
return acc
}, '')
console.log(envs)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment