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

Introduce new expanded configuration #5

Merged
merged 15 commits into from
Dec 22, 2020

Conversation

Bullfrog1234
Copy link
Contributor

This pull request makes the following changes:

  • Expanded configuration functionality
  • Validation of the configuration file (using yup) with some parts falling back to defaults if required
  • Updated logging using chalk for formatting, including alerts on anytime it is falling back to defaults

The full config is now:

Field Default Value Type Description
helpers ["authUserEmail", "authUserEmailIsVerified", "authUserUid", "existingData", "hasAmtOfWriteFields", "incomingData", "isAuthenticated"] array(strings) | boolean used to add helper functions to the output, this can be true to include all helper functions or false to include non of the helper functions or an array of the function names
custom_helpers_folder null null | string path to user defined helper functions
rules_version "1" "1" | "2" | 1 | 2 which version is the rules written in
rules_folder "rules" string folder where the rule fragments can be found
rules_output "firestore.rules" string name of the file to output to
use_firebase_config false boolean use the firebase config file firebase.json to get the rules output file name and location

This is the first time I have contributed to a library so please tell me if there is something I sould have done.

Bullfrog1234 and others added 15 commits October 31, 2020 17:49
purpose is for selective import
ensuring test files don't commit
Purpose:
- used to read the config file and validate its contents

New config file fields:
⚙️ helpers: accepts array of function names as well as true or false
⚙️custom_helper_folder: place to find helper functions
⚙️rules_version: accepts both strings and numbers
⚙️rules_folder: where to find the rules
⚙️rules_output: where to output the final file
⚙️use_firebase_config: to get output file name from firebase.json

Validation established for each config field with appropriate logging
@lupas
Copy link
Owner

lupas commented Dec 17, 2020

Hey @Bullfrog1234

Wow - thanks a lot for this PR - appreciate it! Seems to add a lot of new functionality!
I'm busy until the weekend, but will hopefully find time then to look at it and merge if all looks good.

You'll hear from me,

Thanks again
Pascal

@lupas lupas self-assigned this Dec 17, 2020
@Bullfrog1234
Copy link
Contributor Author

Hey @lupas

No problem, hope it is all up to your standard

I found this library and started using it to build rules in 4 of my projects, I made the changes for those projects, but in the end I decided to share back with you to hopeful provide benefits to others

Cheers,
Bullfrog

@lupas lupas merged commit 1085a42 into lupas:master Dec 22, 2020
@lupas
Copy link
Owner

lupas commented Dec 22, 2020

Hey @Bullfrog1234

Finally had time to look at the PR and gotta say - this is some awesome work!
Thanks a lot for your effort - you really made this module shine ;-)

I tested it and fixed a small thing, but in general this looks great to me.

Already published it as v1.0.0.

Thanks again a lot - appreciate it.

Best regards & Merry Christmas!
Pascal

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.

2 participants