-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat: Allow updating Parse Server options dynamically #8449
base: alpha
Are you sure you want to change the base?
Conversation
I will reformat the title to use the proper commit message syntax. |
Thanks for opening this pull request! |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## alpha #8449 +/- ##
=======================================
Coverage 94.33% 94.33%
=======================================
Files 183 183
Lines 14515 14519 +4
=======================================
+ Hits 13692 13697 +5
+ Misses 823 822 -1
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
I'm not sure about dynamically creating getters and setters |
The proxy handler only allows existing methods defined in Parse Server options to be called using If there is a future Parse server option that has the prefix 'set', this feature would have to be modified to support it. But, at the moment, we don't have such options so it seems unnecessary to code it in now. The PR works by:
|
This may be intuitive for a Java developer by the concept of it, but we are creating new method names that are nowhere documented and we expect developers to infer them from option names by guessing (as soon as there is a "setFlag" option one can only speculate what the setter / getter naming would be). What is the benefit of adding these setters / getters vs. the simple Cons:
Pros:
What do we have in Parse.Cloud that is similar? |
I think it's mostly a preference of styling (and I think Javascript Proxies are cool), but I understand your reservations as the syntax |
Yes, I understand what you mean, and JS proxies are cool 😀 If we find more pros in the future let's add them. For now I think the cons outnumber. |
This PR allows to update server options, but whether a new option value will be used by the server depends on how the option is implemented. For example, if an option is read from the config at start-up and then cached somewhere in a controller or adapter, only updating the option won't reinitialize the controller. That would mean that each option needs to be considered separately and decided whether to allow it to be updated or not. Some options may need code changes, other may never be changeable without restart. Could that be an issue? |
Yes, you are correct in your assumption. We would have to asses / rework at a per Parse Server option basis. For example, changing the databaseURI would probably have no impact on a running Parse Server |
We could add a parameter to the option parser / composer to flag whether an option can be changed on-the-fly or requires restart. Like the Based on that flag Parse Server can deny |
Pull Request
Issue
Currently, Parse Server config can be updated via
Parse.Server = newConfig
Closes: #8448
Approach
Allow new Parse.Server hooks with the prefix of set, which allow for dynamic change of config. Such as:
Parse.Server.setSilent(false);
Parse.Server.set('silent', false);
Tasks