MCPcopy Index your code
hub / github.com/parse-community/parse-server / cloudConfig

Function cloudConfig

src/GraphQL/loaders/configQueries.js:5–30  ·  view source on GitHub ↗
(context, paramName)

Source from the content-addressed store, hash-verified

3import { createSanitizedError } from '../../Error';
4
5const cloudConfig = async (context, paramName) => {
6 const { config, auth } = context;
7
8 if (!auth.isMaster) {
9 throw createSanitizedError(
10 Parse.Error.OPERATION_FORBIDDEN,
11 'Master Key is required to access GlobalConfig.'
12 );
13 }
14
15 const results = await config.database.find('_GlobalConfig', { objectId: '1' }, { limit: 1 });
16
17 if (results.length !== 1) {
18 return { value: null, isMasterKeyOnly: null };
19 }
20
21 const globalConfig = results[0];
22 const params = globalConfig.params || {};
23 const masterKeyOnly = globalConfig.masterKeyOnly || {};
24
25 if (params[paramName] !== undefined) {
26 return { value: params[paramName], isMasterKeyOnly: masterKeyOnly[paramName] ?? null };
27 }
28
29 return { value: null, isMasterKeyOnly: null };
30};
31
32const load = (parseGraphQLSchema) => {
33 if (!parseGraphQLSchema.cloudConfigType) {

Callers 1

resolveFunction · 0.85

Calls 2

createSanitizedErrorFunction · 0.90
findMethod · 0.65

Tested by

no test coverage detected