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

feature - Customize the configuration file location and use a simpler configuration format (not YAML) #15

Closed
medz opened this issue Sep 7, 2022 · 2 comments · Fixed by #17
Assignees

Comments

@medz
Copy link
Owner

medz commented Sep 7, 2022

Add a runtime configuration file, which is added to git ignore, and moves to other directories with the program's compiled binaries.

E.g: .prismarc:

DATABASE_URL = postgres://seven@localhost:5432/demo?schema=public

Add configuration items in pubspec.yaml to specify the path of the runtime configuration file (compared to the location of pubspec.yaml):

prisma:
  prismarc: .prismarc # Prisma runtime configuration, and dotenv can be selected or set together
  dotenv: .env # Prisma runtime load dotenv file, and prismarc can be selected or set together
  schame: prisma/schema.prisma # Custom Prisma schema file path

Find runtime configuration order:

  • step 1: Read the prisma runtime configuration file path in pubspec.yaml, if it is not configured or can't find pubspec.yaml, it will pop up. Note: It is relatively easy to find the pubspec.yaml file, just read it directly from the current running directory.
  • step 2: Read the .prismarc configuration file from the current working directory, and exit if the file does not exist
  • step 3: Read a .prismarc file from the current script directory
  • step 4: Merge environment variables
@medz
Copy link
Owner Author

medz commented Sep 7, 2022

Merge configuration from downstream

@medz
Copy link
Owner Author

medz commented Sep 7, 2022

To achieve it, I created a generic config package 👉 https://pub.dev/packages/rc ,Used to implement runtime configuration.

Obviously, runtime configuration is more complex than dotenv, but simpler than YAML because it only uses a unary key-value form. Should be as simple as docenv if you don't use feature configuration.

@medz medz linked a pull request Sep 8, 2022 that will close this issue
@medz medz closed this as completed in #17 Sep 8, 2022
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 a pull request may close this issue.

1 participant