Skip to content

Instantly share code, notes, and snippets.

@Bogidon
Last active August 17, 2016 18:57
Show Gist options
  • Save Bogidon/8da9ae29902ad552a51dd4ee31b1fec7 to your computer and use it in GitHub Desktop.
Save Bogidon/8da9ae29902ad552a51dd4ee31b1fec7 to your computer and use it in GitHub Desktop.
Automate adding environment variables to CircleCI
// 1. Go to env vars page in project settings
// 2. Fill in info below
// 3. Paste contents into your browser's developer console
var envs = //your object with KEY:VALUE
var i = 0;
var keys = Object.keys(envs)
function recurse() {
var key = keys[i]
var value = envs[key];
$.ajax({
type :'POST',
url: // the env vars page url as a string,
data: {name: key, value: value},
headers: {'X-CSRFToken': window.CSRFToken},
success: function() {
i++;
recurse()
}
});
}
recurse()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment