-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Make engineType configurable via an environment variable #9411
Comments
Setting the engineType value on the already generated Client will not work, as this only influences the generation process of the Additional complexity comes from the fact that there already is a general env var to override the
|
Reading over this along with recent discussion in Slack... The generator config seems to have a different lifecycle than the PSL. Part of what's cool about PSL is you could (and often do) generate different clients with different options. To me it looks like we're using the PSL as a convenient place to specify and transfer config for the (our) generator. I like that it keeps things to a single file (convenient), but here we're seeing the lack of flexibility mismatch in lifecycle. It doesn't look like |
I think a CLI is a sensitive option that would work and make things simpler: Env var:
CLI param:
I suggest we explore the CLI param option, since it seems to not cause confusion potentially and seems to cause less friction for users to start/stop using the Prisma Data Proxy and everyone else who doesn’t need to set the engine type to a custom value. |
Howdy, I just started deploying my first data-proxy example and I'm wrestling with this exact issue. I would say from a dev perspective this doesn't sound especially burdensome? If I'm doing it right (big if!) the env helper sounds like what I want, and being responsible for an env variable is what I would expect to be the cost. |
There happened internal discussion around this that is not replicated here - but we are honing in on a solution. If you have the time to experiment, there actually might already be one implemented to try out and report back if it works: |
Adding to @janpio's comment, generating a data proxy-compatible client would look like this in Preview:
Questions about the interplay:
|
@janpio this is available on 3.1.0-integration-data-proxy-engine.1 or should I upgrade to a newer release? |
@dan-made that should be available in that version, yes. But I am trying this out myself right now as well, so feel free to wait until I report back. |
A quick test deployment failed with Either way this sounds better than editing the schema file in CI, which was my plan an hour ago 😅 |
Will report back in a bit where we are and let you know. (Dataproxy preview features is not a thing yet, @matthewmueller is talking about the future setup here - so that is expected.) |
I had db push in my build script for testing it out and it occurs to me this is probably the same issue surfaced about migrate. Removing that script builds as expected with the env variable set. |
I can confirm that |
Closing since this is already possible with |
Problem
The engine type should change depending on if you're working locally or in production. The typical way to do this is to use environment variables. However, right now it's not possible to change the engine type based on environment.
This means that when you deploy to different environments, you need to manually edit your Prisma Schema. This is error prone.
Suggested solution
Alternatives
Specify a CLI flag, something like:
The text was updated successfully, but these errors were encountered: