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

Allow passing the env on Engine init #2004

Merged
merged 4 commits into from
Jun 10, 2021
Merged

Allow passing the env on Engine init #2004

merged 4 commits into from
Jun 10, 2021

Conversation

pimeys
Copy link
Contributor

@pimeys pimeys commented Jun 9, 2021

Parameter env takes an object, that should reflect the system environment. E.g. process.env in node.

closes: prisma/prisma#7522
closes: prisma/prisma#7562

Parameter `env` takes an object, that should reflect the system
environment. E.g. `process.env` in node.
@pimeys pimeys added this to the 2.25.0 milestone Jun 9, 2021
Copy link
Contributor

@tomhoule tomhoule left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would work to have a trait EnvProvider { fn var(&self, var_name: &str) -> Option<String>; }, then without duplicating, the existing methods could take &dyn EnvProvider. We would then have a NativeEnvProvider and a VirtualEnvProvider. Wdyt?

@pimeys
Copy link
Contributor Author

pimeys commented Jun 10, 2021

Do you think it would work to have a trait EnvProvider { fn var(&self, var_name: &str) -> Option<String>; }, then without duplicating, the existing methods could take &dyn EnvProvider. We would then have a NativeEnvProvider and a VirtualEnvProvider. Wdyt?

Took simpler approach by just requiring Fn(&str) -> Option<String> instead of a full trait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants