Skip to content

Commit 3db2171

Browse files
mtrezzadavimacedo
authored andcommitted
added section about master key config (#667)
* added section about master key config * Update _includes/cloudcode/cloud-code-advanced.md Co-Authored-By: Tom Fox <[email protected]> * updated field wording according to dashboard * added section about master key config * Update _includes/cloudcode/cloud-code-advanced.md Co-Authored-By: Tom Fox <[email protected]> * updated field wording according to dashboard * added internal config docs
1 parent e129790 commit 3db2171

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

_includes/cloudcode/cloud-code-advanced.md

+10
Original file line numberDiff line numberDiff line change
@@ -569,3 +569,13 @@ Here's an example of the JSON data that would be sent in the request to this web
569569
```
570570

571571
After setting up your webhook in the Dashboard UI, you'll be acurately decrementing comment counts!
572+
573+
# Config
574+
Parse Config offers a convenient way to configure parameters in Cloud Code.
575+
576+
```javascript
577+
const config = await Parse.Config.get({useMasterKey: true});
578+
const privateParam = config.get("privateParam");
579+
```
580+
581+
By default, Parse Config parameters can be publicly read which may be undesired if the parameter contains sensitive information that should not be exposed to clients. A parameter can be made readable only with the master key by setting the `Requires master key?` property via the Parse Dashboard to `Yes`.

_includes/js/config.md

+16
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ Parse.Config.get().then(function(config) {
5555
});
5656
```
5757

58+
## Internal Config
59+
60+
By default, Parse Config parameters can be publicly read which may be undesired if the parameter contains sensitive information that should not be exposed to clients. A parameter can be saved as readable only with the master key by adding a flag as the second argument.
61+
62+
```javascript
63+
await Parse.Config.save(
64+
{ welcomeMessage : "Welcome to Parse", secretMessage: "Psst 👀" },
65+
{ secretMessage: true }
66+
);
67+
68+
const publicConfig = await Parse.Config.get(); // Returns only `welcomeMessage`.
69+
const internalConfig = await Parse.Config.get({ useMasterKey: true }); // Returns `welcomeMessage` and `secretMessage`.
70+
```
71+
72+
If a parameter is not provided or set to `false` in the second argument, it can be retrieved without using the master key.
73+
5874
## Current Config
5975

6076
Every `Parse.Config` instance that you get is always immutable. When you retrieve a new `Parse.Config` in the future from the network, it will not modify any existing `Parse.Config` instance, but will instead create a new one and make it available via `Parse.Config.current()`. Therefore, you can safely pass around any `current()` object and safely assume that it will not automatically change.

assets/js/bundle.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)