-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Implementing GET /config and POST /config support #283
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
Conversation
@@ -75,6 +78,7 @@ function classNameIsValid(className) { | |||
className === '_Session' || | |||
className === '_SCHEMA' || //TODO: remove this, as _SCHEMA is not a valid class name for storing Parse Objects. | |||
className === '_Role' || | |||
className === '_GlobalConfig' || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't really go here, as this is the place for the names of classes that the client is allowed to create. _SCHEMA
is only here for legacy reasons, it should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, but as I see it it's used by ExportAdapter
(see https://github.com/theill/parse-server/blob/master/ExportAdapter.js#L63) to filter what collections you're able to query. Is it because I'm going through wrong path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExportAdapter
is the legacy user of this class that needs to be fixed before we can remove _SCHEMA
from the list of valid class names. Take a look at schemas.js
for how do it without using the classNameIsValid
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll take a look. It seems to be schemas.js
uses req.config.database.collection
to access a collection which eventually ends up with classNameIsValid
too but I'll dig a bit deeper tonight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you are right. Maybe we need a database.rawCollection()
function or something like that, to bypass the classNameIsValid
check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will work but then we need one for update
too because the current update
also uses database.collection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or I can just do rawCollection().findAndModify()
on it if that's ok. I'll update my PR with that and wait for your comments.
@theill updated the pull request. |
@@ -0,0 +1,49 @@ | |||
// run test when changing related file using | |||
// $ TESTING=1 node_modules/jasmine/bin/jasmine.js spec/ParseGlobalConfig.spec.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one of our team members is in the middle of making some changes to our testing framework, so this comment is probably going to become out of date soon. Can you remove it? We'll keep instructions for how to run tests in CONTRIBUTING.md
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, submitted patch 7733ab9
@theill updated the pull request. |
Updated tests accordingly to changed access
@theill updated the pull request. |
@theill updated the pull request. |
@@ -60,6 +60,9 @@ defaultColumns = { | |||
"expiresAt": {type:'Date'}, | |||
"createdWith": {type:'Object'}, | |||
}, | |||
_GlobalConfig: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This defaultColumns
object only tracks default columns for collections that contain Parse Objects (thats what _SCHEMA
isn't in here. So I think config probably shouldn't be here either.
Looking awesome! As soon as this is hidden behind the experimental flag, I can land this. We just don't want to get into a situation where we are shipping a new version on npm that includes in-progress features, like we accidentally did for schemas API :) Thanks for the great work! |
@theill updated the pull request. |
@theill updated the pull request. |
@theill updated the pull request. |
@theill updated the pull request. |
@theill updated the pull request. |
Implementing GET /config and POST /config support
Hello So /1/config is now available ? If yes I think you should update https://parse.com/docs/server/guide#migrating Thanks |
Config is still experimental. We are doing further testing and will update the docs once we are confident in the implementation and its compatibility with Parse.com. |
Anyone know if this Parse Config addition is included in the 2.0.8 parse-server npm? If not, any ideas when it might get packaged up? I just pushed 2.0.8 to the Heroku server and still got "Cannot GET /1/config" Thanks |
@sghamaty Did you change PARSE_MOUNT=/1 ? If not, the proper path is /parse/config by default. |
Yes, my PARSE_MOUNT=/1 . Still not working. On Tue, Feb 16, 2016 at 3:41 PM, Fosco Marotto notifications@github.com
|
You also need to set PARSE_EXPERIMENTAL_CONFIG_ENABLED=1 environment variable. |
Yes, that did it. Thanks
|
Is it possible to do something like |
@douineauromain It's not, but a PR that added this in |
Adds support for retrieving global configuration by handling GET requests for
/config
. This will return a JSON payload with anparams
attribute with config.Furthermore support for doing a POST to /config for updating this value.