UNPKG

@dooboostore/simple-boot-http-server

Version:
44 lines (43 loc) 1.63 kB
// src/option/HttpServerOption.ts import { SimOption } from "@dooboostore/simple-boot/SimOption"; var HttpServerOption = class _HttpServerOption extends SimOption { static { this.DEFAULT_PORT = 8081; } static { this.DEFAULT_HOSTNAME = "127.0.0.1"; } constructor({ serverOption, listen, filters, requestEndPoints, closeEndPoints, errorEndPoints, sessionOption, globalAdvice, fileUploadTempPath, noSuchRouteEndPointMappingThrow, transactionManagerFactory } = {}, initSimOption) { super(initSimOption); this.serverOption = serverOption; this.listen = Object.assign({ port: _HttpServerOption.DEFAULT_PORT, hostname: _HttpServerOption.DEFAULT_HOSTNAME }, listen); this.filters = filters; this.requestEndPoints = requestEndPoints; this.closeEndPoints = closeEndPoints; this.errorEndPoints = errorEndPoints; this.sessionOption = Object.assign({ key: "SBSESSIONID", expiredTime: 1e3 * 60 * 30 }, sessionOption); this.globalAdvice = globalAdvice; this.fileUploadTempPath = fileUploadTempPath; this.noSuchRouteEndPointMappingThrow = noSuchRouteEndPointMappingThrow; this.transactionManagerFactory = transactionManagerFactory; } get hostname() { return this.listen.hostname; } get port() { return this.listen.port; } get protocol() { return this.isSecure ? "https" : "http"; } get address() { return `${this.protocol}://${this.hostname}:${this.port}`; } get isSecure() { return this.serverOption && "key" in this.serverOption && "cert" in this.serverOption; } }; export { HttpServerOption }; //# sourceMappingURL=index.js.map