@rpcbase/server 0.15.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/database.js +16 -0
- package/express/index.js +1 -0
- package/express/session.js +1 -1
- package/index.js +8 -2
- package/mongoose/index.js +4 -0
- package/package.json +2 -1
package/database.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
const mongoose = require("mongoose")
|
|
3
|
+
const validator = require("validator")
|
|
4
|
+
|
|
5
|
+
const {DATABASE_PORT} = process.env
|
|
6
|
+
|
|
7
|
+
if (typeof DATABASE_PORT === "string" && !validator.isPort(DATABASE_PORT)) {
|
|
8
|
+
throw new Error("expected DATABASE_PORT to be a valid port number")
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const mongo_url = `mongodb://database:${DATABASE_PORT}/commit-queue`
|
|
12
|
+
|
|
13
|
+
module.exports = async() => {
|
|
14
|
+
const ret = await mongoose.connect(mongo_url)
|
|
15
|
+
// TODO: handle connection ret
|
|
16
|
+
}
|
package/express/index.js
CHANGED
package/express/session.js
CHANGED
|
@@ -6,7 +6,7 @@ const redis_store = require("connect-redis")(session)
|
|
|
6
6
|
|
|
7
7
|
const {SESSION_STORE_PORT} = process.env
|
|
8
8
|
|
|
9
|
-
if (!validator.isPort(SESSION_STORE_PORT)) {
|
|
9
|
+
if (typeof SESSION_STORE_PORT === "string" && !validator.isPort(SESSION_STORE_PORT)) {
|
|
10
10
|
throw new Error("expected SESSION_STORE_PORT to be a valid port number")
|
|
11
11
|
}
|
|
12
12
|
|
package/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/* @flow */
|
|
2
|
-
const rpc_router = require("./rpc/rpc_router")
|
|
3
2
|
const client_router = require("./client/client_router")
|
|
3
|
+
const database = require("./database")
|
|
4
|
+
const express = require("./express")
|
|
5
|
+
const mongoose = require("./mongoose")
|
|
6
|
+
const rpc_router = require("./rpc/rpc_router")
|
|
7
|
+
|
|
4
8
|
|
|
5
9
|
module.exports = {
|
|
10
|
+
client_router,
|
|
11
|
+
database,
|
|
6
12
|
express,
|
|
13
|
+
mongoose,
|
|
7
14
|
rpc_router,
|
|
8
|
-
client_router,
|
|
9
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"license": "SSPL-1.0",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"express": "4.17.2",
|
|
17
17
|
"express-session": "1.17.2",
|
|
18
18
|
"glob": "7.2.0",
|
|
19
|
+
"mongoose": "6.1.5",
|
|
19
20
|
"redis": "3.1.2",
|
|
20
21
|
"validator": "13.7.0",
|
|
21
22
|
"yargs": "17.3.1"
|