config-leaf icon indicating copy to clipboard operation
config-leaf copied to clipboard

Use password stored in an environmental variable

Open ahadik opened this issue 9 years ago • 2 comments

I've had a difficult time integrating this module into some continuous delivery pipelines like PM2 because for some reason (I really don't know why) piping a password using echo (echo 'my_pass' | npm run encrypt) doesn't work in the isolated environments set up to build and deploy code.

To get around this, I've added support for a single flag --PW to which you pass the name of an environmental variable set to a desired password.

Example use in package.json: encrypt: encrypt config.json config.json.cast5 --PW=ENV_VAR

This by-passes manual password entry from stdin and instead uses the value found at the --PW environmental variable, if it exits. If the environmental variable is not set, the command exits with exit status 1.

ahadik avatar May 21 '16 19:05 ahadik

awesome, please merge this ;)

ziarno avatar Oct 20 '16 09:10 ziarno

FYI, I just submitted a similar PR #8 that adds support for passing the password as a command line argument (I did it before noticing this existing PR).

ripper234 avatar Feb 19 '17 14:02 ripper234