hughsk/envify

Set environment variables from the file

vadimdemedes opened this issue · 6 comments

Would be lovely, if envify supported setting env variables from the file (e.g. .env):

$ envify -f .env

.env:

VAR1=abc
VAR2=cba

Real use case: storing API keys for some services (e.g. MapBox) in .env file and wanting to replace process.env.API_KEY in code with those values.

Happy to submit a PR, if you also want this feature.

I'm generally hesitant to endorse adding features to this package, but I feel this might be a useful addition to the cli. I'd be happy to review a PR on this.

It wouldn't be very useful if this feature remained only in CLI and not in the lib/custom.js, as (I assume) most people use envify as a browserify transformer (browserify -t envify).

Oh yeah, that's what I meant haha. As long as it's an action that happens on the command line it's fine. Just don't think reading files should be part of the js api as that would mangle concerns.

This functionality would be better implemented in a separate package, envify already has too many features as-is. See also: envlocalify.

No worries ;)

@hughsk Thanks for envlocalify reference.