@rpcbase/server 0.305.0 → 0.307.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_native.js CHANGED
@@ -1,4 +1,5 @@
1
1
  /* @flow */
2
+ const assert = require("assert")
2
3
  const {spawn} = require("child_process")
3
4
  const path = require("path")
4
5
  const fs = require("fs")
@@ -13,6 +14,7 @@ const mkdirp = require("mkdirp")
13
14
 
14
15
  const is_production = process.env.NODE_ENV === "production"
15
16
 
17
+
16
18
  const NO_PRINT_LIST = [
17
19
  // "database",
18
20
  ]
@@ -28,6 +30,8 @@ const get_env = () => {
28
30
  const get_processes = (args) => {
29
31
  const env = get_env()
30
32
 
33
+ assert(env.RB_APP_NAME, "missing RB_APP_NAME in env")
34
+
31
35
  const infrastructure_conf_dir = path.join(__dirname, "../infrastructure")
32
36
 
33
37
  // db storage
@@ -42,6 +46,8 @@ const get_processes = (args) => {
42
46
  const worker_queue_dir = path.join(process.cwd(), "../infrastructure/data/worker-queue/data")
43
47
  const worker_queue_logs_path = path.join(process.cwd(), "../infrastructure/data/worker-queue/log/logs.txt")
44
48
 
49
+ const has_uds = true
50
+
45
51
  // TODO: add a redis cache
46
52
  const processes = [
47
53
  // web server
@@ -67,6 +73,7 @@ const get_processes = (args) => {
67
73
  "--quiet",
68
74
  "--dbpath", db_path,
69
75
  "--port", env.DATABASE_PORT,
76
+ ...(has_uds ? ["--unixSocketPrefix", `/tmp/${env.RB_APP_NAME}`, "--filePermissions", "0700"] : []),
70
77
  // "--bind_ip_all",
71
78
  // if in verbose mode, print to stdout, else write to file
72
79
  ...(args.verbose ? [] : ["--logpath", db_logs_path]),
package/database.js CHANGED
@@ -13,7 +13,7 @@ require("./src/models/Invite")
13
13
  require("./src/models/ResetPasswordToken")
14
14
 
15
15
 
16
- const {DATABASE_NAME, DATABASE_PORT} = process.env
16
+ const {RB_APP_NAME, DATABASE_PORT} = process.env
17
17
 
18
18
 
19
19
  // database can be set by env variable or passed as paramaters to
@@ -22,16 +22,16 @@ if (typeof DATABASE_PORT !== "string" || !isPort(DATABASE_PORT)) {
22
22
  throw new Error("expected DATABASE_PORT to be a valid port number")
23
23
  }
24
24
 
25
- if (typeof DATABASE_NAME !== "string") {
26
- throw new Error("expected DATABASE_NAME to be a string")
25
+ if (typeof RB_APP_NAME !== "string") {
26
+ throw new Error("expected RB_APP_NAME in env to be a string")
27
27
  }
28
28
 
29
29
  const hostname = is_docker() ? "database" : "127.0.0.1"
30
30
 
31
- const mongo_url = `mongodb://${hostname}:${DATABASE_PORT}/${DATABASE_NAME}?directConnection=true&replicaSet=rs0`
31
+ const mongo_url = `mongodb://${hostname}:${DATABASE_PORT}/${RB_APP_NAME}?directConnection=true&replicaSet=rs0`
32
32
 
33
33
 
34
- // TODO: handle multiple databases, remove DATABASE_NAME env ??
34
+ // TODO: handle multiple databases, remove RB_APP_NAME env ??
35
35
  module.exports = async(...database_names) => {
36
36
  // set listeners before attempting to connect
37
37
  mongoose.connection.on("connected", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.305.0",
3
+ "version": "0.307.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -22,7 +22,8 @@ const set_stored_values = async(payload, ctx) => {
22
22
  {ctx}
23
23
  )
24
24
 
25
- assert(res.modifiedCount === 1, `unable to update user stored values`)
25
+ // TODO: this breaks on signup???
26
+ // assert(res.modifiedCount === 1, `unable to update user stored values`)
26
27
 
27
28
  return {status: "ok"}
28
29
  }