watson / ci-info

Get details about the current Continuous Integration environment
MIT License
321 stars 50 forks source link

Parametrable env #33

Open nfroidure opened 5 years ago

nfroidure commented 5 years ago

Just find this plugin and would like to use it but I'm stuck with its current design.

My use case is that I need to pass in an env object instead of just process.env here https://github.com/nfroidure/metapak/blob/master/src/metapak.js#L88

Basically what I need is a isCi(env = process.env) function and something like a getInfo(env = process.env) one for the above code that is heavier.

It would also have the nice side effect to be able to to lazy compute the data provided by this plugin and only compute the informations you need. One can til memoize the function if needed then to avoid multiple runs.

The tests would probably be much simpler too.

If you agree we that, let me know, I can do the PR. It would require a major version bump though.

nfroidure commented 5 years ago

@watson poking just in case you missed it. wdyt ?

stavalfi commented 4 years ago

it doesn't need major version bump because the env can be optional parameter. if none is passed, it will use process.env.

@nfroidure did you find alternative? i'm also stuck.

nfroidure commented 4 years ago

@stavalfi nope, just not using it atm. That said, one could just do process.env = myEnv but find it ugly and error prone.