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

Environment variables and added .env #13

Closed
wants to merge 8 commits into from

Conversation

jacobaraujo7
Copy link
Contributor

@jacobaraujo7 jacobaraujo7 commented Sep 6, 2022

Added .env file support.
Also added Stacktrace to better find errors.

@medz
Copy link
Owner

medz commented Sep 6, 2022

@Ali1Ammar @skillLan What do you think of this new feature?

@jacobaraujo7
Copy link
Contributor Author

@medz
Copy link
Owner

medz commented Sep 7, 2022

https://www.prisma.io/docs/guides/development-environment/environment-variables#using-env-files

I don't think this is well supported by simply parsing .env. The current implementation of dotenv on pub.dev is fine. Maybe we need to create a dotenv ourselves (the reason is that I tried to contact the dotenv author and got no response.)

@medz
Copy link
Owner

medz commented Sep 7, 2022

@jacobaraujo7 I have rethought this problem, we may need to redesign the configuration, and solve the problem by the way:

  1. Simpler and more direct format than dotenv
  2. All configuration names in the program inherit from Prisma JS/TS client
  3. Easier custom configuration file names and paths
  4. Runtime configuration is easier to move and read
  5. Runtime configuration allows sharing configuration from downstream

For this, I created a new requirement issue to document this feature 👉 #15

medz added a commit that referenced this pull request Sep 7, 2022
@jacobaraujo7
Copy link
Contributor Author

jacobaraujo7 commented Sep 7, 2022

Hello.
I'm taking into account how Prisma works in Node. Currently I don't know how it works in Go or Python.

The objective of this feature is to bring the Dart Prisma closer and closer to the Prisma used in NodeJS, making it easier to understand that it already comes from this stack.

Personally, I prefer to add the environment variable directly to the system, but as many use it, I decided to make this effort.

@medz
Copy link
Owner

medz commented Sep 7, 2022

If Dart allows environment variables to be overwritten at runtime, it may be good to configure with .env. However, the environment variable of Dart VM is read-only and cannot be overwritten or appended. The experience of using dotenv in Dart is really bad.

@medz
Copy link
Owner

medz commented Sep 7, 2022

Maybe we can give the option downstream, use the dot priama runtime configuration, or dotenv, depending on how it is configured in pubspce.yaml and the .env file is loaded by default.

@jacobaraujo7
Copy link
Contributor Author

jacobaraujo7 commented Sep 7, 2022

@medz I agree with this point. It really is much better to add the environment variables directly into the system or with --define.
My point is about the marketing of the tool, since some Prisma users already have the habit of using .env in their projects and this practice is referenced in the official Prisma documentation.
However, if we are going to disregard the .env, we will keep this commit preventing null errors and this commit.

I will close this pullrequest.

@jacobaraujo7
Copy link
Contributor Author

I made a new PR with only this 2 commits.
#16

@medz
Copy link
Owner

medz commented Sep 8, 2022

@jacobaraujo7 Released version 2.1.0 👉 https://github.com/odroe/prisma-dart/releases/tag/2.1.0

Environment variable configuration using .env files is covered.

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

Successfully merging this pull request may close these issues.

None yet

2 participants