Suggestion for managing Environment Variables

Matt Bettinson's Avatar

Matt Bettinson

22 Sep, 2016 02:53 PM

Hi!

I have just needed to update an Environment Variable that is used across all of our projects en masse. This variable is essentially a copy for each project, which obviously creates a bit of an overhead when wanting to update it's value.

Ideally, being able to share a particular variable from a 'global' context so I have a central place to manage this would be great. Each project could then reference this if it so wished, and I could update it's value once. Instead, I have to update each individual instance of this value in every single project.

What I ended up doing was writing a Powershell script to use the REST API to pull back all of our projects, and for each one use the 'PUT /api/projects/{accountName}/{projectSlug}/settings/yaml' endpoint to update the value if it's present using a regular expression to update the block of YML.

Indeed, this particular endpoint could be jazzed up a little to a) interact with settings directly instead of only being able to pull back ALL settings and update ALL the settings and b) use JSON in the request/response instead of the 'plain/text' block of YML that is being passed back and forth (which is requiring me to perform string manipulation using regex instead of directly playing with the properties I'm after).

Perhaps a 'GET /api/projects/{accountName}/{projectSlug}/settings/environment/variables/{name}' endpoint returning the value and a 'PUT /api/projects/{accountName}/{projectSlug}/settings/environment/variables/{name}' with a body of { 'value': '<some new value'>}?

Just a couple of suggestions of how to make life a little easier managing the environment variables across multiple projects.

Cheers!

Matt

  1. Support Staff 1 Posted by Feodor Fitsner on 23 Sep, 2016 04:23 AM

    Feodor Fitsner's Avatar

    Having "Global" environment variables applied to all projects is great idea, thank you! I've added a new issue for that: https://github.com/appveyor/ci/issues/1068

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:08 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac