@rpcbase/server 0.262.0 → 0.263.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/cli/get_runtime.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
/* @flow */
|
|
2
|
-
const
|
|
2
|
+
const is_docker = require("@rpcbase/std/is_docker")
|
|
3
3
|
|
|
4
|
-
const {CONTAINER_MODE} = process.env
|
|
5
4
|
|
|
6
5
|
const get_runtime = () => {
|
|
7
|
-
|
|
8
|
-
return "docker"
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (os.platform() === "darwin") {
|
|
12
|
-
return "native"
|
|
13
|
-
} else {
|
|
14
|
-
return "docker"
|
|
15
|
-
}
|
|
6
|
+
return is_docker() ? "docker" : "native"
|
|
16
7
|
}
|
|
17
8
|
|
|
18
9
|
module.exports = get_runtime
|
package/cli/run_native.js
CHANGED
|
@@ -12,7 +12,6 @@ const get_runtime = require("./get_runtime")
|
|
|
12
12
|
const start_server = async(args) => {
|
|
13
13
|
const infrastructure_dir = path.join(process.cwd(), "../infrastructure")
|
|
14
14
|
|
|
15
|
-
// TODO: remove and rely on container_mode only
|
|
16
15
|
const runtime = get_runtime()
|
|
17
16
|
|
|
18
17
|
// prefix
|
package/database.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
const isPort = require("validator/lib/isPort")
|
|
3
3
|
|
|
4
|
+
const is_docker = require("@rpcbase/std/is_docker")
|
|
5
|
+
|
|
4
6
|
const mongoose = require("./mongoose")
|
|
5
7
|
|
|
6
8
|
const pack = require("./package.json")
|
|
@@ -11,7 +13,7 @@ require("./src/models/Invite")
|
|
|
11
13
|
require("./src/models/ResetPasswordToken")
|
|
12
14
|
|
|
13
15
|
|
|
14
|
-
const {DATABASE_NAME, DATABASE_PORT
|
|
16
|
+
const {DATABASE_NAME, DATABASE_PORT} = process.env
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
// database can be set by env variable or passed as paramaters to
|
|
@@ -24,7 +26,7 @@ if (typeof DATABASE_NAME !== "string") {
|
|
|
24
26
|
throw new Error("expected DATABASE_NAME to be a string")
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
const hostname =
|
|
29
|
+
const hostname = is_docker() ? "database" : "127.0.0.1"
|
|
28
30
|
|
|
29
31
|
const mongo_url = `mongodb://${hostname}:${DATABASE_PORT}/${DATABASE_NAME}?directConnection=true&replicaSet=rs0`
|
|
30
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.263.0",
|
|
4
4
|
"license": "SSPL-1.0",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@rpcbase/access-control": "0.27.0",
|
|
14
|
-
"@rpcbase/agent": "0.
|
|
15
|
-
"@rpcbase/std": "0.
|
|
16
|
-
"@sentry/node": "7.
|
|
14
|
+
"@rpcbase/agent": "0.33.0",
|
|
15
|
+
"@rpcbase/std": "0.12.0",
|
|
16
|
+
"@sentry/node": "7.72.0",
|
|
17
17
|
"bluebird": "3.7.2",
|
|
18
18
|
"body-parser": "1.20.2",
|
|
19
19
|
"bull": "4.11.3",
|
|
20
|
-
"connect-redis": "
|
|
20
|
+
"connect-redis": "7.1.0",
|
|
21
21
|
"cors": "2.8.5",
|
|
22
22
|
"debug": "4.3.4",
|
|
23
23
|
"dotenv": "16.3.1",
|
|
24
24
|
"express": "4.18.2",
|
|
25
25
|
"express-session": "1.17.3",
|
|
26
|
-
"firebase-admin": "11.
|
|
26
|
+
"firebase-admin": "11.11.0",
|
|
27
27
|
"glob": "9.3.5",
|
|
28
28
|
"lodash": "4.17.21",
|
|
29
29
|
"mkdirp": "2.1.3",
|
package/queue/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
const Queue = require("bull")
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const is_docker = require("@rpcbase/std/is_docker")
|
|
5
|
+
|
|
6
|
+
const {WORKER_QUEUE_PORT} = process.env
|
|
7
|
+
|
|
8
|
+
const hostname = is_docker() ? "worker-queue" : "127.0.0.1"
|
|
9
|
+
|
|
6
10
|
const worker_queue_url = `redis://${hostname}:${WORKER_QUEUE_PORT}`
|
|
7
11
|
|
|
8
12
|
const QUEUE_NAME = "worker-queue"
|
|
9
13
|
|
|
10
|
-
|
|
11
14
|
const tasks_list = Object.create(null)
|
|
12
15
|
|
|
13
16
|
let worker_queue
|
|
@@ -7,7 +7,7 @@ const {createClient} = require("redis")
|
|
|
7
7
|
const redis_store = require("connect-redis")(session)
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
const {SESSION_STORE_PORT,
|
|
10
|
+
const {SESSION_STORE_PORT, APP_DOMAIN} = process.env
|
|
11
11
|
assert(SESSION_STORE_PORT, "SESSION_STORE_PORT is undefined")
|
|
12
12
|
|
|
13
13
|
|
|
@@ -22,9 +22,8 @@ if (typeof SESSION_STORE_PORT === "string" && !validator.isPort(SESSION_STORE_PO
|
|
|
22
22
|
throw new Error("expected SESSION_STORE_PORT to be a valid port number")
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const hostname =
|
|
25
|
+
const hostname = is_docker() ? "session-store" : "127.0.0.1"
|
|
26
26
|
|
|
27
|
-
console.log("COTNAINER")
|
|
28
27
|
console.log("session-store hostname", hostname, "port", SESSION_STORE_PORT)
|
|
29
28
|
|
|
30
29
|
let session_middleware = null
|
|
@@ -77,7 +76,7 @@ setTimeout(async() => {
|
|
|
77
76
|
// WARNING: apparently doesn't work on localhost or .local domains
|
|
78
77
|
// https://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain
|
|
79
78
|
// TODO: WTF IS THIS
|
|
80
|
-
// if (
|
|
79
|
+
// if (is_docker() && typeof APP_DOMAIN === "string" && APP_DOMAIN.trim() !== "") {
|
|
81
80
|
// log("\n\n")
|
|
82
81
|
// log("SETTING COOKIE DOMAIN TO", APP_DOMAIN)
|
|
83
82
|
// log("SETTING secure", APP_DOMAIN)
|
|
@@ -90,8 +89,6 @@ setTimeout(async() => {
|
|
|
90
89
|
|
|
91
90
|
|
|
92
91
|
session_middleware = session(session_config)
|
|
93
|
-
|
|
94
|
-
// TODO: is this still necessary
|
|
95
92
|
}, 200)
|
|
96
93
|
|
|
97
94
|
|