Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koatty_core

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koatty_core - npm Package Compare versions

Comparing version 1.1.11 to 1.2.2

2

CHANGELOG.md

@@ -5,2 +5,4 @@ # Changelog

### [1.2.2](https://github.com/koatty/koatty_core/compare/v1.1.4...v1.2.2) (2021-11-12)
### [1.1.4](https://github.com/koatty/koatty_core/compare/v1.1.2...v1.1.4) (2021-11-11)

@@ -7,0 +9,0 @@

16

dist/Application.d.ts

@@ -1,7 +0,1 @@

/**
* @ author: richen
* @ copyright: Copyright (c) - <richenlin(at)gmail.com>
* @ license: BSD (3-Clause)
* @ version: 2020-07-06 11:21:37
*/
import Koa from "koa";

@@ -71,3 +65,13 @@ import { Application } from "koatty_container";

strict?: boolean;
/**
* Server protocol, 'http' | 'https' | 'http2' | 'grpc' | 'ws' | 'wss'
*/
protocol: string;
/**
* gRPC protocol file
*/
protoFile?: string;
/**
* Other extended configuration
*/
ext?: any;

@@ -74,0 +78,0 @@ }

@@ -11,2 +11,3 @@ "use strict";

*/
const fs_1 = tslib_1.__importDefault(require("fs"));
const koa_1 = tslib_1.__importDefault(require("koa"));

@@ -164,4 +165,4 @@ const Helper = tslib_1.__importStar(require("koatty_lib"));

listen(serve, listeningListener) {
var _a;
const protocol = this.config("protocol") || "http"; // 'http' | 'https' | 'grpc' | 'ws' | 'wss'
var _a, _b, _c;
const protocol = this.config("protocol") || "http";
const port = process.env.PORT || process.env.APPPORT || this.config('app_port') || 3000;

@@ -173,11 +174,23 @@ const hostname = process.env.IP || ((_a = process.env.HOSTNAME) === null || _a === void 0 ? void 0 : _a.replace(/-/g, '.')) || this.config('app_host') || 'localhost';

protocol: protocol,
// listenUrl: `${protocol}://${hostname || '127.0.0.1'}:${port}/`,
ext: {
// key: "",
// cert: "",
// protoFile: "",
},
key: "",
cert: "",
protoFile: "",
}
};
// serve and start
serve(this, options, listeningListener);
const pm = new Set(["https", "http2", "wss"]);
if (pm.has(protocol)) {
const keyFile = (_b = this.config("key_file")) !== null && _b !== void 0 ? _b : "";
const crtFile = (_c = this.config("crt_file")) !== null && _c !== void 0 ? _c : "";
options.ext.key = fs_1.default.readFileSync(keyFile).toString();
options.ext.cert = fs_1.default.readFileSync(crtFile).toString();
}
if (protocol === "https" || protocol === "http2") {
options.port = options.port == 80 ? 443 : options.port;
}
if (protocol === "grpc") {
const proto = this.config("protoFile", "router");
options.ext.protoFile = proto;
}
serve(this, options, listeningListener(this, options));
return null;

@@ -184,0 +197,0 @@ }

{
"name": "koatty_core",
"version": "1.1.11",
"version": "1.2.2",
"description": "Koatty routing component, adapt to http1/2, websocket, gRPC.",

@@ -64,2 +64,2 @@ "scripts": {

}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc