Skip to content

Commit b9c936f

Browse files
authored
Add Docs for Server Config Definitions (parse-community#5581)
* Add Docs for Server Config Definitions * protected field and sort alphabetically * Add links * nits
1 parent 90c81c1 commit b9c936f

File tree

8 files changed

+372
-368
lines changed

8 files changed

+372
-368
lines changed

CONTRIBUTING.md

+11
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ If your pull request introduces a change that may affect the storage or retrieva
7070
- `it_only_db('mongo')` // will make a test that only runs on mongo
7171
- `it_exclude_dbs(['postgres'])` // will make a test that runs against all DB's but postgres
7272

73+
### Generate Parse Server Config Definition
74+
75+
If you want to make changes to [Parse Server Configuration][config] add the desired configuration to [src/Options/index.js][config-index] and run `npm run definitions`. This will output [src/Options/Definitions.js][config-def] and [src/Options/docs.js][config-docs].
76+
77+
To view docs run `npm run docs` and check the `/out` directory.
78+
7379
### Code of Conduct
7480

7581
This project adheres to the [Contributor Covenant Code of Conduct](https://github.com/parse-community/parse-server/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to honor this code.
82+
83+
[config]: http://parseplatform.org/parse-server/api/master/ParseServerOptions.html
84+
[config-def]: https://github.com/parse-community/parse-server/blob/master/src/Options/Definitions.js
85+
[config-docs]: https://github.com/parse-community/parse-server/blob/master/src/Options/docs.js
86+
[config-index]: https://github.com/parse-community/parse-server/blob/master/src/Options/index.js

README.md

+4-27
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ app.listen(1337, function() {
189189
});
190190
```
191191

192-
For a full list of available options, run `parse-server --help`.
192+
For a full list of available options, run `parse-server --help` or take a look at [Parse Server Configurations](http://parseplatform.org/parse-server/api/master/ParseServerOptions.html).
193193

194194
## Logging
195195

@@ -209,13 +209,13 @@ Logs are also be viewable in Parse Dashboard.
209209

210210
# Documentation
211211

212-
The full documentation for Parse Server is available in the [wiki](https://github.com/parse-community/parse-server/wiki). The [Parse Server guide](http://docs.parseplatform.org/parse-server/guide/) is a good place to get started. If you're interested in developing for Parse Server, the [Development guide](http://docs.parseplatform.org/parse-server/guide/#development-guide) will help you get set up.
212+
The full documentation for Parse Server is available in the [wiki](https://github.com/parse-community/parse-server/wiki). The [Parse Server guide](http://docs.parseplatform.org/parse-server/guide/) is a good place to get started. An [API reference](http://parseplatform.org/parse-server/api/) is also available. If you're interested in developing for Parse Server, the [Development guide](http://docs.parseplatform.org/parse-server/guide/#development-guide) will help you get set up.
213213

214214
## Configuration
215215

216216
Parse Server can be configured using the following options. You may pass these as parameters when running a standalone `parse-server`, or by loading a configuration file in JSON format using `parse-server path/to/configuration.json`. If you're using Parse Server on Express, you may also pass these to the `ParseServer` object as options.
217217

218-
For the full list of available options, run `parse-server --help`.
218+
For the full list of available options, run `parse-server --help` or take a look at [Parse Server Configurations](http://parseplatform.org/parse-server/api/master/ParseServerOptions.html).
219219

220220
#### Basic options
221221

@@ -238,29 +238,6 @@ The client keys used with Parse are no longer necessary with Parse Server. If yo
238238

239239
#### Advanced options
240240

241-
* `fileKey` - For migrated apps, this is necessary to provide access to files already hosted on Parse.
242-
* `preserveFileName` - Set to true to remove the unique hash added to the file names. Defaults to false.
243-
* `allowClientClassCreation` - Set to false to disable client class creation. Defaults to true.
244-
* `enableAnonymousUsers` - Set to false to disable anonymous users. Defaults to true.
245-
* `auth` - Used to configure support for [3rd party authentication](http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication).
246-
* `facebookAppIds` - An array of valid Facebook application IDs that users may authenticate with.
247-
* `mountPath` - Mount path for the server. Defaults to `/parse`.
248-
* `directAccess` - Replace HTTP Interface when using JS SDK in current node runtime. Defaults to false. Caution, this is an experimental feature that may not be appropriate for production.
249-
* `filesAdapter` - The default behavior (GridStore) can be changed by creating an adapter class (see [`FilesAdapter.js`](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Files/FilesAdapter.js)).
250-
* `maxUploadSize` - Max file size for uploads. Defaults to 20 MB.
251-
* `loggerAdapter` - The default behavior/transport (File) can be changed by creating an adapter class (see [`LoggerAdapter.js`](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Logger/LoggerAdapter.js)).
252-
* `logLevel` - Set the specific level you want to log. Defaults to `info`. The default logger uses the npm log levels as defined by the underlying winston logger. Check [Winston logging levels](https://github.com/winstonjs/winston#logging-levels) for details on values to specify.
253-
* `sessionLength` - The length of time in seconds that a session should be valid for. Defaults to 31536000 seconds (1 year).
254-
* `maxLimit` - The maximum value supported for the limit option on queries. Defaults to unlimited.
255-
* `revokeSessionOnPasswordReset` - When a user changes their password, either through the reset password email or while logged in, all sessions are revoked if this is true. Set to false if you don't want to revoke sessions.
256-
* `accountLockout` - Lock account when a malicious user is attempting to determine an account password by trial and error.
257-
* `passwordPolicy` - Optional password policy rules to enforce.
258-
* `customPages` - A hash with urls to override email verification links, password reset links and specify frame url for masking user-facing pages. Available keys: `parseFrameURL`, `invalidLink`, `choosePassword`, `passwordResetSuccess`, `verifyEmailSuccess`.
259-
* `middleware` - (CLI only), a module name, function that is an express middleware. When using the CLI, the express app will load it just **before** mounting parse-server on the mount path. This option is useful for injecting a monitoring middleware.
260-
* `masterKeyIps` - The array of ip addresses where masterKey usage will be restricted to only these ips. (Default to [] which means allow all ips). If you're using this feature and have `useMasterKey: true` in cloudcode, make sure that you put your own ip in this list.
261-
* `readOnlyMasterKey` - A masterKey that has full read access to the data, but no write access. This key should be treated the same way as your masterKey, keeping it private.
262-
* `objectIdSize` - The string length of the newly generated object's ids.
263-
264241
##### Logging
265242

266243
Use the `PARSE_SERVER_LOGS_FOLDER` environment variable when starting `parse-server` to save your server logfiles to the specified folder.
@@ -369,7 +346,7 @@ The default port is 1337, to use a different port set the PORT environment varia
369346
$ PORT=8080 parse-server --appId APPLICATION_ID --masterKey MASTER_KEY
370347
```
371348

372-
For the full list of configurable environment variables, run `parse-server --help`.
349+
For the full list of configurable environment variables, run `parse-server --help` or take a look at [Parse Server Configuration](https://github.com/parse-community/parse-server/blob/master/src/Options/Definitions.js).
373350

374351
### Available Adapters
375352

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"supports-color": "6.0.0"
7272
},
7373
"scripts": {
74+
"definitions": "node ./resources/buildConfigDefinitions.js",
7475
"docs": "jsdoc -c ./jsdoc-conf.json",
7576
"dev": "npm run build && node bin/dev",
7677
"lint": "flow && eslint --cache ./",

release_docs.sh

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ then
2222
echo "<meta http-equiv='refresh' content='0; url=/parse-server/api/${DEST}'>" > "docs/api/index.html"
2323
fi
2424

25+
npm run definitions
2526
npm run docs
2627

2728
mkdir -p "docs/api/${DEST}"

resources/buildConfigDefinitions.js

+19-10
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ function processProperty(property, iface) {
106106

107107
function doInterface(iface) {
108108
return iface.body.properties
109+
.sort((a, b) => a.key.name.localeCompare(b.key.name))
109110
.map((prop) => processProperty(prop, iface))
110111
.filter((e) => e !== undefined);
111112
}
@@ -135,42 +136,50 @@ function mapperFor(elt, t) {
135136
}
136137

137138
function parseDefaultValue(elt, value, t) {
138-
let litteralValue;
139+
let literalValue;
139140
if (t.isStringTypeAnnotation(elt)) {
140141
if (value == '""' || value == "''") {
141-
litteralValue = t.stringLiteral('');
142+
literalValue = t.stringLiteral('');
142143
} else {
143-
litteralValue = t.stringLiteral(value);
144+
literalValue = t.stringLiteral(value);
144145
}
145146
} else if (t.isNumberTypeAnnotation(elt)) {
146-
litteralValue = t.numericLiteral(parsers.numberOrBoolParser('')(value));
147+
literalValue = t.numericLiteral(parsers.numberOrBoolParser('')(value));
147148
} else if (t.isArrayTypeAnnotation(elt)) {
148149
const array = parsers.objectParser(value);
149-
litteralValue = t.arrayExpression(array.map((value) => {
150+
literalValue = t.arrayExpression(array.map((value) => {
150151
if (typeof value == 'string') {
151152
return t.stringLiteral(value);
152153
} else {
153154
throw new Error('Unable to parse array');
154155
}
155156
}));
156157
} else if (t.isAnyTypeAnnotation(elt)) {
157-
litteralValue = t.arrayExpression([]);
158+
literalValue = t.arrayExpression([]);
158159
} else if (t.isBooleanTypeAnnotation(elt)) {
159-
litteralValue = t.booleanLiteral(parsers.booleanParser(value));
160+
literalValue = t.booleanLiteral(parsers.booleanParser(value));
160161
} else if (t.isGenericTypeAnnotation(elt)) {
161162
const type = elt.typeAnnotation.id.name;
162163
if (type == 'NumberOrBoolean') {
163-
litteralValue = t.numericLiteral(parsers.numberOrBoolParser('')(value));
164+
literalValue = t.numericLiteral(parsers.numberOrBoolParser('')(value));
164165
}
165166
if (type == 'CustomPagesOptions') {
166167
const object = parsers.objectParser(value);
167168
const props = Object.keys(object).map((key) => {
168169
return t.objectProperty(key, object[value]);
169170
});
170-
litteralValue = t.objectExpression(props);
171+
literalValue = t.objectExpression(props);
172+
}
173+
if (type == 'ProtectedFields') {
174+
const prop = t.objectProperty(
175+
t.stringLiteral('_User'), t.objectPattern([
176+
t.objectProperty(t.stringLiteral('*'), t.arrayExpression([t.stringLiteral('email')]))
177+
])
178+
);
179+
literalValue = t.objectExpression([prop]);
171180
}
172181
}
173-
return litteralValue;
182+
return literalValue;
174183
}
175184

176185
function inject(t, list) {

0 commit comments

Comments
 (0)