@rpcbase/server 0.250.0 → 0.252.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/boot/setup_env.js CHANGED
@@ -5,17 +5,11 @@ const dotenv = require("dotenv")
5
5
  const wd = process.cwd()
6
6
 
7
7
  const shared_env_path = path.join(wd, "../../.env")
8
- const base_env_path = path.join(wd, "./.env.base")
9
8
  const env_path = path.join(wd, "./.env")
10
9
 
11
10
  const res_shared = dotenv.config({path: shared_env_path})
12
- const res_base = dotenv.config({path: base_env_path})
13
11
  const res = dotenv.config({path: env_path})
14
12
 
15
- if (res_base.error) {
16
- throw res_base.error
17
- }
18
-
19
13
  if (res.error) {
20
14
  throw res.error
21
15
  }
package/boot/shared.js CHANGED
@@ -1,6 +1,8 @@
1
1
  /* @flow */
2
2
  require("./setup_env")
3
3
 
4
+ require("../src/helpers/expect_ext")
5
+
4
6
  const mongoose = require("../mongoose")
5
7
  require("@rpcbase/access-control")(mongoose)
6
8
 
package/cli/run_docker.js CHANGED
@@ -10,7 +10,6 @@ const is_ci = process.env.CI === "true"
10
10
  const run_docker = async(infrastructure_dir, proj_prefix, args) => {
11
11
  // env
12
12
  const env_path = path.relative(infrastructure_dir, path.join(process.cwd(), "./.env"))
13
- const base_env_path = path.relative(infrastructure_dir, path.join(process.cwd(), "./.env.base"))
14
13
 
15
14
  const exists = (f) => {
16
15
  const target_path = path.join(infrastructure_dir, f)
@@ -42,7 +41,7 @@ const run_docker = async(infrastructure_dir, proj_prefix, args) => {
42
41
 
43
42
 
44
43
  const cmd = "docker compose"
45
- const cmd_args = ["--env-file", base_env_path, "--env-file", env_path, "-p", proj_prefix, ...compose_files, "up", ...opts]
44
+ const cmd_args = ["--env-file", env_path, "-p", proj_prefix, ...compose_files, "up", ...opts]
46
45
 
47
46
  console.log("CMD", cmd_args.join(" "))
48
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.250.0",
3
+ "version": "0.252.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -0,0 +1,42 @@
1
+ /* @flow */
2
+ const {expect} = require("expect")
3
+
4
+ const isMongoId = require("validator/lib/isMongoId")
5
+ const isEmail = require("validator/lib/isEmail")
6
+
7
+
8
+ expect.extend({
9
+ toBeMongoId: (actual) => {
10
+ const pass = isMongoId(actual)
11
+
12
+ if (pass) {
13
+ return {
14
+ message: () => `expected ${this.utils.printReceived(actual)} not to be a valid mongoId`,
15
+ pass: true,
16
+ }
17
+ } else {
18
+ return {
19
+ message: () => `expected ${this.utils.printReceived(actual)} to be a valid mongoId`,
20
+ pass: false,
21
+ }
22
+ }
23
+ },
24
+ toBeEmail: (actual) => {
25
+ const pass = isEmail(actual)
26
+
27
+ if (pass) {
28
+ return {
29
+ message: () =>
30
+ `expected ${this.utils.printReceived(actual)} not to be a valid email address`,
31
+ pass: true,
32
+ }
33
+ } else {
34
+ return {
35
+ message: () => `expected ${this.utils.printReceived(actual)} to be a valid email address`,
36
+ pass: false,
37
+ }
38
+ }
39
+ },
40
+ })
41
+
42
+ global.expect = expect