pwmckenna / node-travis-encrypt

node module to encrypt environment variables for travis-ci
npmjs.org/package/travis-encrypt
46 stars 12 forks source link

Adding ability to write to a given key in .travis.yml #20

Closed daffl closed 8 years ago

daffl commented 8 years ago

Thank you for this tool! It is very helpful when you don't want people with Node having to install the Travis CLI which requires Ruby.

However, when updating our Guide (http://donejs.com/place-my-order.html) to use it instead of Travis CLI I ran into the problem that it only allows to update the environment variables but it is also possible to encrypt other keys, e.g. the Heroku API key for automated deployment.

I added the option to pass a key name to the CLI (e.g. --add deploy.api_key). It should be mostly backwards compatible according to the documentation, e.g.

travis-encrypt --add -r pwmckenna/node-travis-encrypt ENV1=VALUE1 ENV2=VALUE2

But

travis-encrypt -r pwmckenna/node-travis-encrypt --add ENV1=VALUE1 ENV2=VALUE2

won't work because it will now try to use ENV1=VALUE1 as the key.

daffl commented 8 years ago

It should also fix an issue I had if the initial environment variable configuration isn't an array, e.g.

env:
  global:
    secure: <stuff>
pwmckenna commented 8 years ago

@daffl thanks for the patch. I love the feature. :evergreen_tree: :evergreen_tree: :evergreen_tree: @rexxars has done a ton of work around improving the api, so I just want to be sure that it fits in with his vision. @rexxars thoughts?

rexxars commented 8 years ago

This looks great! We had this feature for a while but I didn't know if anyone was using it, and it complicated the CLI argument passing - now that I know people are using it, I think it's definitely worthwhile.

Good job.

daffl commented 8 years ago

Thanks folks! Let me know when it got out into a release so that I can merge our documentation changes.

rexxars commented 8 years ago

Published as 2.1.0 a minute ago :+1: