@routr/simpleauth 2.0.8-alpha.9 → 2.0.13

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/dist/envs.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const BIND_ADDR: string;
2
+ export declare const WHITELIST: string[];
3
+ export declare const METHODS: string[];
4
+ export declare const PATH_TO_AUTH: string;
package/dist/envs.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var _a, _b, _c, _d, _e;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PATH_TO_AUTH = exports.METHODS = exports.WHITELIST = exports.BIND_ADDR = void 0;
5
+ /*
6
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
7
+ * http://github.com/fonoster
8
+ *
9
+ * This file is part of Routr.
10
+ *
11
+ * Licensed under the MIT License (the "License");
12
+ * you may not use this file except in compliance with
13
+ * the License. You may obtain a copy of the License at
14
+ *
15
+ * https://opensource.org/licenses/MIT
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
23
+ const common_1 = require("@routr/common");
24
+ common_1.Assertions.assertEnvsAreSet(["PATH_TO_AUTH", "METHODS"]);
25
+ exports.BIND_ADDR = (_a = process.env.BIND_ADDR) !== null && _a !== void 0 ? _a : "0.0.0.0:51903";
26
+ exports.WHITELIST = (_c = (_b = process.env.WHITELIST) === null || _b === void 0 ? void 0 : _b.split(",")) !== null && _c !== void 0 ? _c : [];
27
+ exports.METHODS = (_e = (_d = process.env.METHODS) === null || _d === void 0 ? void 0 : _d.split(",")) !== null && _e !== void 0 ? _e : [];
28
+ exports.PATH_TO_AUTH = process.env.PATH_TO_AUTH;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /*
5
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster
7
+ *
8
+ * This file is part of Routr.
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const common_1 = require("@routr/common");
23
+ const envs_1 = require("./envs");
24
+ common_1.HealthCheck.check(envs_1.BIND_ADDR);
package/dist/runner.js CHANGED
@@ -3,10 +3,9 @@
3
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
- var _a, _b, _c, _d, _e;
7
6
  Object.defineProperty(exports, "__esModule", { value: true });
8
7
  /*
9
- * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
8
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
10
9
  * http://github.com/fonoster/routr
11
10
  *
12
11
  * This file is part of Routr
@@ -26,25 +25,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
25
  // eslint-disable-next-line @typescript-eslint/no-var-requires
27
26
  require("./tracer").init("simpleauth");
28
27
  const service_1 = __importDefault(require("./service"));
29
- const common_1 = require("@routr/common");
30
28
  const logger_1 = require("@fonoster/logger");
29
+ const envs_1 = require("./envs");
31
30
  const logger = (0, logger_1.getLogger)({ service: "simpleauth", filePath: __filename });
32
- common_1.Assertions.assertEnvsAreSet(["PATH_TO_AUTH", "METHODS"]);
33
- const whiteList = (_b = (_a = process.env.WHITELIST) === null || _a === void 0 ? void 0 : _a.split(",")) !== null && _b !== void 0 ? _b : [];
34
- const methods = (_d = (_c = process.env.METHODS) === null || _c === void 0 ? void 0 : _c.split(",")) !== null && _d !== void 0 ? _d : [];
35
31
  try {
36
32
  // eslint-disable-next-line @typescript-eslint/no-var-requires
37
- const users = require(process.env.PATH_TO_AUTH);
33
+ const users = require(envs_1.PATH_TO_AUTH);
38
34
  (0, service_1.default)({
39
- bindAddr: (_e = process.env.BIND_ADDR) !== null && _e !== void 0 ? _e : "0.0.0.0:51903",
40
35
  users,
41
- whiteList,
42
- methods
36
+ bindAddr: envs_1.BIND_ADDR,
37
+ whiteList: envs_1.WHITELIST,
38
+ methods: envs_1.METHODS
43
39
  });
44
40
  }
45
41
  catch (e) {
46
42
  if (e.code === "MODULE_NOT_FOUND") {
47
- logger.error(`auth file not found [path = ${process.env.PATH_TO_AUTH}]`);
43
+ logger.error(`auth file not found [path = ${envs_1.PATH_TO_AUTH}]`);
48
44
  }
49
45
  else {
50
46
  logger.error(e);
package/dist/service.js CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  /*
8
- * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
8
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
9
9
  * http://github.com/fonoster/routr
10
10
  *
11
11
  * This file is part of Routr
package/dist/tracer.js CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.init = void 0;
7
7
  /*
8
- * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
8
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
9
9
  * http://github.com/fonoster/routr
10
10
  *
11
11
  * This file is part of Routr
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/simpleauth",
3
- "version": "2.0.8-alpha.9",
3
+ "version": "2.0.13",
4
4
  "description": "This middleware delegates authentication to an external service",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -16,11 +16,12 @@
16
16
  "build": "tsc -b tsconfig.json"
17
17
  },
18
18
  "bin": {
19
- "run_simpleauth": "dist/runner.js"
19
+ "run_simpleauth": "dist/runner.js",
20
+ "healthcheck_simpleauth": "dist/healthcheck.js"
20
21
  },
21
22
  "dependencies": {
22
- "@fonoster/logger": "0.3.18",
23
- "@grpc/grpc-js": "^1.5.9",
23
+ "@fonoster/logger": "0.3.20",
24
+ "@grpc/grpc-js": "^1.8.4",
24
25
  "@opentelemetry/api": "^1.0.4",
25
26
  "@opentelemetry/exporter-jaeger": "^1.0.4",
26
27
  "@opentelemetry/instrumentation": "^0.27.0",
@@ -29,8 +30,8 @@
29
30
  "@opentelemetry/sdk-trace-base": "^1.0.4",
30
31
  "@opentelemetry/sdk-trace-node": "^1.0.4",
31
32
  "@opentelemetry/semantic-conventions": "^1.0.4",
32
- "@routr/common": "^2.0.8-alpha.9",
33
- "@routr/processor": "^2.0.8-alpha.9",
33
+ "@routr/common": "^2.0.13",
34
+ "@routr/processor": "^2.0.13",
34
35
  "google-protobuf": "^3.9.2"
35
36
  },
36
37
  "files": [
@@ -46,5 +47,5 @@
46
47
  "bugs": {
47
48
  "url": "https://github.com/fonoster/routr/issues"
48
49
  },
49
- "gitHead": "9ebb361db74fad2b3891fc9add683ddfde2efdff"
50
+ "gitHead": "476d11cfb4fd3dc9847a0829cae6fece84d048df"
50
51
  }