Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a SetEnvVars API method #361

Open
stephenh opened this issue May 28, 2023 · 1 comment
Open

Add a SetEnvVars API method #361

stephenh opened this issue May 28, 2023 · 1 comment
Labels

Comments

@stephenh
Copy link

Hi! Currently I'm using env-cmd to load .env for script commands in package.json, but when tests are invoked from vscode/webstorm, I'm using Jest's globalSetup with this file:

import { GetEnvVars } from "env-cmd";

export default async function globalSetup() {
  Object.entries(await GetEnvVars()).forEach(([key, value]) => (process.env[key] = value));
}

I've copy/pasted this incantation into a few projects now, and I'd like to be able to do just:

import { SetEnvVars } from "env-cmd";

export default SetEnvVars;

Does that seem reasonable? Happy to work on a PR if so. Thanks!

@toddbluhm
Copy link
Owner

Yeah, more than happy to accept a PR related to this. I don't really know many people using the API, so any API requests or ideas are welcomed!

@toddbluhm toddbluhm added the todo label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants