commitplease
commitplease copied to clipboard
Index: Support custom options via environment variable
When working with a Node-based project in a secure isolated environment, it is imho best practice to only expose the working directory of that one project, and to disallow write access to .git
as this would allow remote shell execution outside the environment when the developer runs git commands later (as opposed to npm commands).
Currently, when a project uses commitplease in its default configuration, this means the 'npm ci' or 'npm install' command fails as it can't write to .git/hooks.
Make it easy for these developers to individually disable 'commitplease' (and run the tests manually) by setting an env variable in their container.
For example, as part of their base environment via:
export npm_config_commitplease_nohook=1
Or ad-hoc, via npm_config_commitplease_nohook=1 npm ci
.
Fixes https://github.com/jzaefferer/commitplease/issues/111
To test this, run the following in the commitplease directory:
npm_config_commitplease_nohook=1 node index.js
Then:
var cp = require('./index.js');
cp.getOptions()
//> {
//> …,
//> nohook: '1'
//> }
/cc @jzaefferer