@rpcbase/server 0.256.0 → 0.258.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/run_docker.js +2 -2
- package/express/custom_cors.js +2 -2
- package/express/index.js +20 -23
- package/package.json +1 -1
- package/rts/index.js +5 -5
package/cli/run_docker.js
CHANGED
|
@@ -3,8 +3,8 @@ const {execSync} = require("child_process")
|
|
|
3
3
|
const path = require("path")
|
|
4
4
|
const fs = require("fs")
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
const is_production =
|
|
6
|
+
|
|
7
|
+
const is_production = process.env.NODE_ENV === "production"
|
|
8
8
|
const is_ci = process.env.CI === "true"
|
|
9
9
|
|
|
10
10
|
const run_docker = async(infrastructure_dir, proj_prefix, args) => {
|
package/express/custom_cors.js
CHANGED
|
@@ -6,9 +6,9 @@ const cors = require("cors")
|
|
|
6
6
|
const log = debug("rb:cors")
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const {RB_SKIP_CORS_PATHS, NODE_ENV, APP_DOMAIN, CLIENT_PORT} = process.env
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const is_production = NODE_ENV === "production"
|
|
12
12
|
|
|
13
13
|
const custom_cors = (app) => {
|
|
14
14
|
|
package/express/index.js
CHANGED
|
@@ -14,9 +14,9 @@ const custom_cors = require("./custom_cors")
|
|
|
14
14
|
|
|
15
15
|
const log = debug("rb:server")
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
17
|
+
const {APP_DOMAIN, NODE_ENV, SENTRY_DSN, CLIENT_PORT} = process.env
|
|
18
|
+
|
|
19
|
+
const is_production = NODE_ENV === "production"
|
|
20
20
|
|
|
21
21
|
const has_sentry = !!SENTRY_DSN
|
|
22
22
|
|
|
@@ -31,31 +31,28 @@ module.exports = () => {
|
|
|
31
31
|
|
|
32
32
|
const app = express()
|
|
33
33
|
|
|
34
|
-
if (has_sentry &&
|
|
34
|
+
if (has_sentry && is_production) {
|
|
35
35
|
Sentry.init({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
dsn: SENTRY_DSN,
|
|
37
|
+
integrations: [
|
|
38
|
+
// enable HTTP calls tracing
|
|
39
|
+
new Sentry.Integrations.Http({
|
|
40
|
+
tracing: true
|
|
41
|
+
}),
|
|
42
|
+
// enable Express.js middleware tracing
|
|
43
|
+
new Sentry.Integrations.Express({
|
|
44
|
+
app
|
|
45
|
+
}),
|
|
46
|
+
],
|
|
47
|
+
// Performance Monitoring
|
|
48
|
+
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!,
|
|
49
|
+
})
|
|
50
50
|
|
|
51
51
|
// Trace incoming requests
|
|
52
|
-
app.use(Sentry.Handlers.requestHandler())
|
|
53
|
-
app.use(Sentry.Handlers.tracingHandler())
|
|
54
|
-
|
|
52
|
+
app.use(Sentry.Handlers.requestHandler())
|
|
53
|
+
app.use(Sentry.Handlers.tracingHandler())
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
59
56
|
app.use(request_ip.mw())
|
|
60
57
|
|
|
61
58
|
app.use(body_parser.json({limit: `${BODY_MAX_SIZE_MB}mb`}))
|
package/package.json
CHANGED
package/rts/index.js
CHANGED
|
@@ -13,8 +13,7 @@ const mongoose = require("../mongoose")
|
|
|
13
13
|
|
|
14
14
|
const log = debug("rb:rts:server")
|
|
15
15
|
|
|
16
|
-
const is_production = process.env.
|
|
17
|
-
|
|
16
|
+
const is_production = process.env.NODE_ENV === "production"
|
|
18
17
|
|
|
19
18
|
const QUERY_MAX_LIMIT = 4096
|
|
20
19
|
|
|
@@ -73,9 +72,10 @@ const dispatch_doc_change = (model, doc) => {
|
|
|
73
72
|
return test_fn(doc)
|
|
74
73
|
})
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
// we don't need to log every missing txn id, it is expected
|
|
76
|
+
// if (!doc.__txn_id) {
|
|
77
|
+
// console.log(colors.yellow("Warning!"), "change on model:", model.modelName, "matching queries", target_queries, "did not include a valid", colors.yellow("__txn"), "field")
|
|
78
|
+
// }
|
|
79
79
|
|
|
80
80
|
// TODO: we should not re-run each query here!!!!
|
|
81
81
|
// dispatch change to target query clients
|