Skip to content

added section about master key config #667

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

Merged
10 changes: 10 additions & 0 deletions _includes/cloudcode/cloud-code-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,13 @@ Here's an example of the JSON data that would be sent in the request to this web
```

After setting up your webhook in the Dashboard UI, you'll be acurately decrementing comment counts!

# Config
Parse Config offers a convenient way to configure parameters in Cloud Code.

```javascript
const config = await Parse.Config.get({useMasterKey: true});
const privateParam = config.get("privateParam");
```

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`.
16 changes: 16 additions & 0 deletions _includes/js/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ Parse.Config.get().then(function(config) {
});
```

## Internal Config

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.

```javascript
await Parse.Config.save(
{ welcomeMessage : "Welcome to Parse", secretMessage: "Psst 👀" },
{ secretMessage: true }
);

const publicConfig = await Parse.Config.get(); // Returns only `welcomeMessage`.
const internalConfig = await Parse.Config.get({ useMasterKey: true }); // Returns `welcomeMessage` and `secretMessage`.
```

If a parameter is not provided or set to `false` in the second argument, it can be retrieved without using the master key.

## Current Config

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.
Expand Down
4 changes: 2 additions & 2 deletions assets/js/bundle.js

Large diffs are not rendered by default.