forked from parse-community/parse-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI for parse-live-query-server (parse-community#2765)
* adds CLI for parse-live-query-server, adds ability to start parse-server with live-query server * Don't crash when the message is badly formatted
- Loading branch information
1 parent
a41cbcb
commit 2183b84
Showing
9 changed files
with
279 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
|
||
require("../lib/cli/parse-live-query-server"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { | ||
numberParser, | ||
numberOrBoolParser, | ||
objectParser, | ||
arrayParser, | ||
moduleOrObjectParser, | ||
booleanParser, | ||
nullParser | ||
} from '../utils/parsers'; | ||
|
||
|
||
export default { | ||
"appId": { | ||
required: true, | ||
help: "Required. This string should match the appId in use by your Parse Server. If you deploy the LiveQuery server alongside Parse Server, the LiveQuery server will try to use the same appId." | ||
}, | ||
"masterKey": { | ||
required: true, | ||
help: "Required. This string should match the masterKey in use by your Parse Server. If you deploy the LiveQuery server alongside Parse Server, the LiveQuery server will try to use the same masterKey." | ||
}, | ||
"serverURL": { | ||
required: true, | ||
help: "Required. This string should match the serverURL in use by your Parse Server. If you deploy the LiveQuery server alongside Parse Server, the LiveQuery server will try to use the same serverURL." | ||
}, | ||
"redisURL": { | ||
help: "Optional. This string should match the masterKey in use by your Parse Server. If you deploy the LiveQuery server alongside Parse Server, the LiveQuery server will try to use the same masterKey." | ||
}, | ||
"keyPairs": { | ||
help: "Optional. A JSON object that serves as a whitelist of keys. It is used for validating clients when they try to connect to the LiveQuery server. Check the following Security section and our protocol specification for details." | ||
}, | ||
"websocketTimeout": { | ||
help: "Optional. Number of milliseconds between ping/pong frames. The WebSocket server sends ping/pong frames to the clients to keep the WebSocket alive. This value defines the interval of the ping/pong frame from the server to clients. Defaults to 10 * 1000 ms (10 s).", | ||
action: numberParser("websocketTimeout") | ||
}, | ||
"cacheTimeout": { | ||
help: "Optional. Number in milliseconds. When clients provide the sessionToken to the LiveQuery server, the LiveQuery server will try to fetch its ParseUser's objectId from parse server and store it in the cache. The value defines the duration of the cache. Check the following Security section and our protocol specification for details. Defaults to 30 * 24 * 60 * 60 * 1000 ms (~30 days).", | ||
action: numberParser("cacheTimeout") | ||
}, | ||
"logLevel": { | ||
help: "Optional. This string defines the log level of the LiveQuery server. We support VERBOSE, INFO, ERROR, NONE. Defaults to INFO.", | ||
}, | ||
"port": { | ||
env: "PORT", | ||
help: "The port to run the ParseServer. defaults to 1337.", | ||
default: 1337, | ||
action: numberParser("port") | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import definitions from './definitions/parse-live-query-server'; | ||
import runner from './utils/runner'; | ||
import { ParseServer } from '../index'; | ||
import express from 'express'; | ||
|
||
runner({ | ||
definitions, | ||
start: function(program, options, logOptions) { | ||
logOptions(); | ||
var app = express(); | ||
var httpServer = require('http').createServer(app); | ||
httpServer.listen(options.port); | ||
ParseServer.createLiveQueryServer(httpServer, options); | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.